From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 593E1C43461 for ; Thu, 10 Sep 2020 13:34:13 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id EBA572087C for ; Thu, 10 Sep 2020 13:34:12 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="gu5pUYn/"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=tcd-ie.20150623.gappssmtp.com header.i=@tcd-ie.20150623.gappssmtp.com header.b="fcQ8pRBP" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org EBA572087C Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=tcd.ie Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-mediatek-bounces+linux-mediatek=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:To:Subject:Message-ID:Date:From:In-Reply-To: References:MIME-Version:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=3YF7pd0Q3YfgwJ/+O+vcAJG3IM4Q2ppFxtCX3i2xSnQ=; b=gu5pUYn/TqD0Z1y2EunvL4yO6 ZG+GTFDhtz5l7u1J7S73salQWe/b+NIGx4ACttgFci+9FNSQ5bofzDZSpRAVRSgukvjs9TfmqqrBM rN2+/HHK6GioOZwXymR6tCtHfzltG6rH3JurRix4cAwVmwb5VAPwv1vY98Hq3od7mL2HwrMWtOZCH 5xI8cJhDeYK/MwCtBoH8y1yp/HkY0NEdsYEn34uZp6eA43XcLVRIDIzO3NXI7azbD1ncbZbEvfHB+ ENQVA+I7bZay9YdipCax5p8wPKR3/NzA7XdGsEfjeOnnhY/St1PHnCa++9p51QEyB0+gqa1SkjwqT 8jxBHd2ug==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kGMiD-0007g7-Um; Thu, 10 Sep 2020 13:34:06 +0000 Received: from mail-io1-xd42.google.com ([2607:f8b0:4864:20::d42]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kGMi5-0007cG-Uz for linux-mediatek@lists.infradead.org; Thu, 10 Sep 2020 13:34:02 +0000 Received: by mail-io1-xd42.google.com with SMTP id j2so7044713ioj.7 for ; Thu, 10 Sep 2020 06:33:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tcd-ie.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=NA4xq/RvWtw1DoG4R42VuDAYvxbq5gOs0uGkp97do30=; b=fcQ8pRBPaEWiThwI4IpJI/6RvrpktlhqIcuTs8ion57IfAcoLZwMinlg018HPs4g0P PfERQLGzgxTimYY/S16DcluJPa3UrMAv2VeDrvrD2khzMlgcNU3uG+U66xQTcGI4k/PB tyd6Y57erW7Jw7CdoQkzGYnD3z09a+1xAJWCw3ZTA9vq0DdHjCGpzxmBZebxDdyQNZ5o a8n4/aQGMi16zmzKxYbuyXtVYNEIktp6No97ibi4qLI+zDV4g/TXIXD87q5g2S3KNUFg wjgBbIjqjQrEef6DxEeF173z4nhe4RTeiKBDtbYrCu4PSy+IwGvrlXsJFLKINZmU1V2I yoXQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=NA4xq/RvWtw1DoG4R42VuDAYvxbq5gOs0uGkp97do30=; b=PBGMG870b0TwAUbVTPCFdKJyqJJAZ7mRSQxTTskEnyZEFs+GTCsyLSuQuCuUJqIHYp C0ON5nKbCf8PL5UpyoS4EBtZ24KrLQ/12Eo/f+LY7NbwXpqBqRK1ggWS7iRGP7QELBPy xPuBckWay8GEo0ArW7DQSXDa1KMFZlegeIxj8uMjp1/HEqouDVhISU/GSwyCRDe2ofNz oVtrDPjudbCKy+xU+J4Dql4qqmTSKIoLoq87R5z8ARTlPKx0ILcXa1z7AFm95Zmgz4/r kKsjI7DAlsXU+2hQL6DBJqpWfpxwaynkIOHg/g0V3X5BR+GQQne//k96Rvw2JFUGBtDK Hw4g== X-Gm-Message-State: AOAM531gNEfvq1HKIQb5jdMhz6NXqduuIE9rMzOWYLO1Z+RxZi61rwc3 wTuZd+7QCxeSutfDDSiYVIagcpXPurhC90y0VyNeqg== X-Google-Smtp-Source: ABdhPJzlID7Qr9FJiMTGq9orpwBT55dMvomyRpqx73nK5lHz5vZjsdxpDDRxLur0/nChDVSeWcISfULGX7CKyavrOhU= X-Received: by 2002:a02:834a:: with SMTP id w10mr8873252jag.63.1599744834395; Thu, 10 Sep 2020 06:33:54 -0700 (PDT) MIME-Version: 1.0 References: <20191221150402.13868-1-murphyt7@tcd.ie> <465815ae-9292-f37a-59b9-03949cb68460@deltatee.com> <20200529124523.GA11817@infradead.org> <33137cfb-603c-86e8-1091-f36117ecfaf3@deltatee.com> <766525c3-4da9-6db7-cd90-fb4b82cd8083@deltatee.com> <60a82319-cbee-4cd1-0d5e-3c407cc51330@linux.intel.com> <7106602a-9964-851e-9c4e-d8acf4033b89@linux.intel.com> In-Reply-To: From: Tom Murphy Date: Thu, 10 Sep 2020 14:33:43 +0100 Message-ID: Subject: Re: [Intel-gfx] [PATCH 0/8] Convert the intel iommu driver to the dma-iommu api To: Tvrtko Ursulin X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200910_093358_136599_70D734A8 X-CRM114-Status: GOOD ( 35.96 ) X-BeenThere: linux-mediatek@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kvm@vger.kernel.org, David Airlie , dri-devel@lists.freedesktop.org, Bjorn Andersson , linux-tegra@vger.kernel.org, Julien Grall , Will Deacon , Marek Szyprowski , Jean-Philippe Brucker , linux-samsung-soc@vger.kernel.org, Marc Zyngier , Krzysztof Kozlowski , Jonathan Hunter , Christoph Hellwig , linux-rockchip@lists.infradead.org, Andy Gross , linux-arm-kernel@lists.infradead.org, linux-s390@vger.kernel.org, linux-arm-msm@vger.kernel.org, intel-gfx@lists.freedesktop.org, linux-mediatek@lists.infradead.org, Matthias Brugger , Thomas Gleixner , virtualization@lists.linux-foundation.org, Gerald Schaefer , Logan Gunthorpe , David Woodhouse , Cornelia Huck , Linux Kernel Mailing List , iommu@lists.linux-foundation.org, Kukjin Kim , Robin Murphy Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "Linux-mediatek" Errors-To: linux-mediatek-bounces+linux-mediatek=archiver.kernel.org@lists.infradead.org On Wed, 9 Sep 2020 at 13:56, Tvrtko Ursulin wrote: > > > On 09/09/2020 10:16, Tvrtko Ursulin wrote: > > On 08/09/2020 23:43, Tom Murphy wrote: > >> On Tue, 8 Sep 2020 at 16:56, Tvrtko Ursulin > >> wrote: > >>> On 08/09/2020 16:44, Logan Gunthorpe wrote: > >>>> On 2020-09-08 9:28 a.m., Tvrtko Ursulin wrote: > >>>>>> > >>>>>> diff --git a/drivers/gpu/drm/i915/i915_scatterlist.h > >>>>>> b/drivers/gpu/drm/i915/i915 > >>>>>> index b7b59328cb76..9367ac801f0c 100644 > >>>>>> --- a/drivers/gpu/drm/i915/i915_scatterlist.h > >>>>>> +++ b/drivers/gpu/drm/i915/i915_scatterlist.h > >>>>>> @@ -27,13 +27,19 @@ static __always_inline struct sgt_iter { > >>>>>> } __sgt_iter(struct scatterlist *sgl, bool dma) { > >>>>>> struct sgt_iter s = { .sgp = sgl }; > >>>>>> > >>>>>> + if (sgl && !sg_dma_len(s.sgp)) > >>>>> > >>>>> I'd extend the condition to be, just to be safe: > >>>>> if (dma && sgl && !sg_dma_len(s.sgp)) > >>>>> > >>>> > >>>> Right, good catch, that's definitely necessary. > >>>> > >>>>>> + s.sgp = NULL; > >>>>>> + > >>>>>> if (s.sgp) { > >>>>>> s.max = s.curr = s.sgp->offset; > >>>>>> - s.max += s.sgp->length; > >>>>>> - if (dma) > >>>>>> + > >>>>>> + if (dma) { > >>>>>> + s.max += sg_dma_len(s.sgp); > >>>>>> s.dma = sg_dma_address(s.sgp); > >>>>>> - else > >>>>>> + } else { > >>>>>> + s.max += s.sgp->length; > >>>>>> s.pfn = page_to_pfn(sg_page(s.sgp)); > >>>>>> + } > >>>>> > >>>>> Otherwise has this been tested or alternatively how to test it? > >>>>> (How to > >>>>> repro the issue.) > >>>> > >>>> It has not been tested. To test it, you need Tom's patch set without > >>>> the > >>>> last "DO NOT MERGE" patch: > >>>> > >>>> https://lkml.kernel.org/lkml/20200907070035.GA25114@infradead.org/T/ > >>> > >>> Tom, do you have a branch somewhere I could pull from? (Just being lazy > >>> about downloading a bunch of messages from the archives.) > >> > >> I don't unfortunately. I'm working locally with poor internet. > >> > >>> > >>> What GPU is in your Lenovo x1 carbon 5th generation and what > >>> graphical/desktop setup I need to repro? > >> > >> > >> Is this enough info?: > >> > >> $ lspci -vnn | grep VGA -A 12 > >> 00:02.0 VGA compatible controller [0300]: Intel Corporation HD > >> Graphics 620 [8086:5916] (rev 02) (prog-if 00 [VGA controller]) > >> Subsystem: Lenovo ThinkPad X1 Carbon 5th Gen [17aa:224f] > >> Flags: bus master, fast devsel, latency 0, IRQ 148 > >> Memory at eb000000 (64-bit, non-prefetchable) [size=16M] > >> Memory at 60000000 (64-bit, prefetchable) [size=256M] > >> I/O ports at e000 [size=64] > >> [virtual] Expansion ROM at 000c0000 [disabled] [size=128K] > >> Capabilities: [40] Vendor Specific Information: Len=0c > >> Capabilities: [70] Express Root Complex Integrated Endpoint, MSI 00 > >> Capabilities: [ac] MSI: Enable+ Count=1/1 Maskable- 64bit- > >> Capabilities: [d0] Power Management version 2 > >> Capabilities: [100] Process Address Space ID (PASID) > >> Capabilities: [200] Address Translation Service (ATS) > > > > Works for a start. What about the steps to repro? Any desktop > > environment and it is just visual corruption, no hangs/stalls or such? > > > > I've submitted a series consisting of what I understood are the patches > > needed to repro the issue to our automated CI here: > > > > https://patchwork.freedesktop.org/series/81489/ > > > > So will see if it will catch something, or more targeted testing will be > > required. Hopefully it does trip over in which case I can add the patch > > suggested by Logan on top and see if that fixes it. Or I'll need to > > write a new test case. > > > > If you could glance over my series to check I identified the patches > > correctly it would be appreciated. > > Our CI was more than capable at catching the breakage so I've copied you > on a patch (https://patchwork.freedesktop.org/series/81497/) which has a > good potential to fix this. (Or improve the robustness of our sg walks, > depends how you look at it.) > > Would you be able to test it in your environment by any chance? If it > works I understand it unblocks your IOMMU work, right? I tested your latest patch set ([PATCH 1/2] drm/i915: Fix DMA mapped scatterlist walks) and it fixes the issue. great work! > > Regards, > > Tvrtko _______________________________________________ Linux-mediatek mailing list Linux-mediatek@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-mediatek