Received: by 2002:a5b:505:0:0:0:0:0 with SMTP id o5csp141411ybp; Wed, 16 Oct 2019 15:22:16 -0700 (PDT) X-Google-Smtp-Source: APXvYqyTa3KKq8QHsp5Tf/+a8SuQOosElnUxt7EXslgxl/5zKHRZUY7le+efZ8cXDzZbrJ/rxl/+ X-Received: by 2002:a17:906:fad7:: with SMTP id lu23mr590777ejb.211.1571264536036; Wed, 16 Oct 2019 15:22:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1571264536; cv=none; d=google.com; s=arc-20160816; b=ys73+d/uUWbN8SaTlDff4P2kXTHvnxx/p2cfHA8kooO8yZYEe2iLA3aQhHTg3A116s uRniB7H5rA+pJdcq1LoRD06JUCPnye5OU/4SbdvSvwJji6DogKFDCLUgx9AUyykGqt2D bk/nPLIlwVskbVmgJJNjLvS9imMCewGFLzJfsW3MMcFUbdaY19Y6aMJiPxL4wI4Yfllm as34IIX6gEyIeI5qsqPrdfcTcZ9ClFQr43XduSaukWM4JCCnEBO0yqrd5iENxHSqmzmR FaXjZMhKrzaDadY46Vx0AhYk5QqxE41XorFycFjC6CvQGlFl4IxlRdRi4YF9qJ6wJ03V 9kSw== 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:mime-version :references:in-reply-to:date:cc:to:from:subject:message-id :dkim-signature; bh=oq8S8FNdMSuL/j2d44Hg8fdfb7pmW+shnprb4O6S0Ms=; b=eyZWO3pfOoIh9JnCTJGkGyV61wlqlwxNJfIdFoK6Xud6QYXfbj1Z7SOHbJ5NWr0/fb oClHh0GCKanugHB06l8bWQCaa2D80J0VDGxQZ0OGtYcRDjhgJV7UivW7oqyxLdyxEve1 3kQ+XjBepQcceCG4Fbq2PB4tV72wFanWVCoLLLaDQDnk5qr3biW0Efn58C3Mb5EUItxI pIUPGeoYKSM/suNDUlU+we1Css4cKlybQXPYwBITpjDUBOai8Vi5wgUIkrt7/Q5IiisL VQEI7qsI9L5JTVIne7A7VCo2NLe2LHmhcKLveTRN507Ik5G/vEhp5XO3ZRg+ECDL1c+d Yz3g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@lca.pw header.s=google header.b="g/UCtlkl"; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id fy7si255485ejb.13.2019.10.16.15.21.53; Wed, 16 Oct 2019 15:22:16 -0700 (PDT) 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=@lca.pw header.s=google header.b="g/UCtlkl"; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2405884AbfJPPxi (ORCPT + 99 others); Wed, 16 Oct 2019 11:53:38 -0400 Received: from mail-qk1-f196.google.com ([209.85.222.196]:42849 "EHLO mail-qk1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726985AbfJPPxh (ORCPT ); Wed, 16 Oct 2019 11:53:37 -0400 Received: by mail-qk1-f196.google.com with SMTP id f16so23211887qkl.9 for ; Wed, 16 Oct 2019 08:53:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=lca.pw; s=google; h=message-id:subject:from:to:cc:date:in-reply-to:references :mime-version:content-transfer-encoding; bh=oq8S8FNdMSuL/j2d44Hg8fdfb7pmW+shnprb4O6S0Ms=; b=g/UCtlklSOkAfjTb2IAewWlunaRFdtYuwHMWE8nNLQ52+TqEcZ1qL/XW462jg80nGS KgDr+S/7Ei+ZW3CubrhL/AZUB2dUkGZzRCsFdN2MVKjRJG/YjZqpH+PvFASc6LYmK0AV eBHPtw7EOXqppjPq93B0t0I97Ize+AuCMiLcqrngzlHh1rUiiBwrWIglzOyukM5QRquH WtjzZj5U379YG5DAQ5ONkHvx/Wv6zd7Mik+szBaEsyj3bQOex+aDDyWrcVE8wgvzxin0 At9cChuOxbOABCJSuRc8svEWhU/2I+YbDjEnlbq2Dg2cU+GxIwZ/YCoyID/ZdzI2s8nP Cl4g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:message-id:subject:from:to:cc:date:in-reply-to :references:mime-version:content-transfer-encoding; bh=oq8S8FNdMSuL/j2d44Hg8fdfb7pmW+shnprb4O6S0Ms=; b=slPJvsZKUkaoWKxgMzgEF6fRMLBLdSDHGBSglYo2VAUfA8fcyw8W6H77AnBVW+E7tT IvrGuV8qCWb9hiMYWTuTPVVIJeogOP+djOVxFNdFqHzLqoHnO8ou1+PB/xRny+dX00nd ZjPvO4Endp8TCpkqtEZ/fhTph4yCcxkjdAr2k/lCtT31wwBLaeeYHnNPURcXtAAOj3ZH l647xe0TtmhXWzD/ZddURdFofHBpWRgzYDI1CyB5PHew3GcWd+FnF/dFrM0ZzxoQmoav v1Es5P46W2tRdztC9tUpa+Y63VeBZ00/DC+rg/BumZ91uY7vacOImRb+17p2dSuL5841 4OVg== X-Gm-Message-State: APjAAAUZnVvzCF5vg8wZv1lSNwg0qyB0sfBwLGffem5+cMNDUgXyuNMj 1bv/ZrrYOACT8axhEls4encFLg== X-Received: by 2002:a37:2ec5:: with SMTP id u188mr41488023qkh.94.1571241215231; Wed, 16 Oct 2019 08:53:35 -0700 (PDT) Received: from dhcp-41-57.bos.redhat.com (nat-pool-bos-t.redhat.com. [66.187.233.206]) by smtp.gmail.com with ESMTPSA id d10sm1683190qko.29.2019.10.16.08.53.33 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 16 Oct 2019 08:53:34 -0700 (PDT) Message-ID: <1571241213.5937.64.camel@lca.pw> Subject: Re: "Convert the AMD iommu driver to the dma-iommu api" is buggy From: Qian Cai To: Joerg Roedel Cc: Tom Murphy , Robin Murphy , Christoph Hellwig , iommu@lists.linux-foundation.org, linux-kernel@vger.kernel.org Date: Wed, 16 Oct 2019 11:53:33 -0400 In-Reply-To: <20191016153112.GF4695@suse.de> References: <1571237707.5937.58.camel@lca.pw> <1571237982.5937.60.camel@lca.pw> <20191016153112.GF4695@suse.de> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.22.6 (3.22.6-10.el7) Mime-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 2019-10-16 at 17:31 +0200, Joerg Roedel wrote: > Hi Qian, > > thanks for the report! > > On Wed, Oct 16, 2019 at 10:59:42AM -0400, Qian Cai wrote: > > On Wed, 2019-10-16 at 10:55 -0400, Qian Cai wrote: > > > Today's linux-next generates a lot of warnings on multiple servers during boot > > > due to the series "iommu/amd: Convert the AMD iommu driver to the dma-iommu api" > > > [1]. Reverted the whole things fixed them. > > > > > > [1] https://lore.kernel.org/lkml/20190908165642.22253-1-murphyt7@tcd.ie/ > > > > > > > BTW, the previous x86 warning was from only reverted one patch "iommu: Add gfp > > parameter to iommu_ops::map" where proved to be insufficient. Now, pasting the > > correct warning. The x86 one might just be a mistake. diff --git a/drivers/iommu/amd_iommu.c b/drivers/iommu/amd_iommu.c index ad05484d0c80..63c4b894751d 100644 --- a/drivers/iommu/amd_iommu.c +++ b/drivers/iommu/amd_iommu.c @@ -2542,7 +2542,7 @@ static int amd_iommu_map(struct iommu_domain *dom, unsigned long iova,         if (iommu_prot & IOMMU_WRITE)                 prot |= IOMMU_PROT_IW;   -       ret = iommu_map_page(domain, iova, paddr, page_size, prot, GFP_KERNEL); +       ret = iommu_map_page(domain, iova, paddr, page_size, prot, gfp);           domain_flush_np_cache(domain, iova, page_size); The arm64 -- does it forget to do this? diff --git a/drivers/iommu/dma-iommu.c b/drivers/iommu/dma-iommu.c index ecc08aef9b58..8dd0ef0656f4 100644 --- a/drivers/iommu/dma-iommu.c +++ b/drivers/iommu/dma-iommu.c @@ -1185,7 +1185,7 @@ static struct iommu_dma_msi_page *iommu_dma_get_msi_page(struct device *dev,         if (!iova)                 goto out_free_page;   -       if (iommu_map(domain, iova, msi_addr, size, prot)) +       if (iommu_map_atomic(domain, iova, msi_addr, size, prot))                 goto out_free_iova;           INIT_LIST_HEAD(&msi_page->list);