Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp175439pxk; Wed, 9 Sep 2020 02:20:03 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxX4ozISiCVz0tmyyXaiCWTEdtA8r6nFS+gBV3+zkDRcJK+N4gBqOJIi5Z3ye8RdjuQohCX X-Received: by 2002:a17:906:a156:: with SMTP id bu22mr2790661ejb.177.1599643203355; Wed, 09 Sep 2020 02:20:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1599643203; cv=none; d=google.com; s=arc-20160816; b=mAs2cP8nZsz8RVb6bkUCWh9XXQNIWMECb9e6K53RZ6GnTFG2GXtc3N0yD5qjlbDy+h bWY28bicffRA3vyuE1VnKU1O/uCI1uOSxYaUslEiH3ZW08wZSMboQLb/aeq7m5mOxTmY ebhoK7UWYhd6H+qxyR1Mt7gmSnc5GCAcnXtxVoMQgxdshAIEhpZ8Eb8i0C68mR4Wz9U2 ZBnLFWPBxzF4S1sXUzeZ2AwzLOIFcco0hojST47Lv5VydTDdSIkZYXNSYSjZTWHMeDMn eyi5st8lGejPzDNMOmpssaThpqtQPE6ElCBu9q2OrW0q9Ibb8tghd8V/z2IlieNUl0Gn +ezQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:organization:from:references:cc:to:subject:ironport-sdr :ironport-sdr; bh=x+sR0fTh09FaChcrv+YXn0zouqS4P66cvCdwbqwG2q0=; b=XGtZBy1dCdTvPRST26WS1Vd9kss1ORedAvOa2GWw0vGhnE0lSrFE0HPdnhikjedzVi p3TwdZI2Au0FnSscAbuI925mL3p9zhk+1RQ66QFBTuSdIVhdR+Kz23zaXoFnKGwgEZXh AHk6eFmW/hv6I+LcoFgfxK1H+02GUWrnZegACwZDb1+8o2dPE4iVcRaGRFB0b+QoLzXg OZ93rqvkFNPpYayQ/nuxv+uwIn8zyqJqGuWkuWTFwSs5xY4D2yugd3S761QIOnnv48Bl HTZQckEyQH0/MUnMb6H6q2xK2uzb0FycX1UY7PhbVmKnUvZK2KFzjFbbCX6ckM4g6om/ R2sw== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id e4si1139587edq.182.2020.09.09.02.19.40; Wed, 09 Sep 2020 02:20:03 -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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727087AbgIIJRL (ORCPT + 99 others); Wed, 9 Sep 2020 05:17:11 -0400 Received: from mga18.intel.com ([134.134.136.126]:62578 "EHLO mga18.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725826AbgIIJRI (ORCPT ); Wed, 9 Sep 2020 05:17:08 -0400 IronPort-SDR: 4UfoviER+163ZOfzvllxRS/M+W5Ldi8Ryv0yri+p+qHvLJVmuHgWLSYY5x76tEdwZa0KKFqs3/ diG40ofYg8CQ== X-IronPort-AV: E=McAfee;i="6000,8403,9738"; a="146013094" X-IronPort-AV: E=Sophos;i="5.76,409,1592895600"; d="scan'208";a="146013094" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga005.jf.intel.com ([10.7.209.41]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 09 Sep 2020 02:16:52 -0700 IronPort-SDR: Eu5LFEF7mQvPvjaKgHiNi+EAI6twzANJVXLRWHJjqt2BIA4DKeAAOOzWigLRgh7pJRkcZk2JZB paZ/kvhmY5KQ== X-IronPort-AV: E=Sophos;i="5.76,409,1592895600"; d="scan'208";a="480390735" Received: from vdc-station-04.ger.corp.intel.com (HELO [10.251.165.91]) ([10.251.165.91]) by orsmga005-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 09 Sep 2020 02:16:41 -0700 Subject: Re: [Intel-gfx] [PATCH 0/8] Convert the intel iommu driver to the dma-iommu api To: Tom Murphy Cc: Logan Gunthorpe , 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 , David Woodhouse , Cornelia Huck , Linux Kernel Mailing List , iommu@lists.linux-foundation.org, Kukjin Kim , Robin Murphy 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> From: Tvrtko Ursulin Organization: Intel Corporation UK Plc Message-ID: <7106602a-9964-851e-9c4e-d8acf4033b89@linux.intel.com> Date: Wed, 9 Sep 2020 10:16:38 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. Regards, Tvrtko