Linux IOMMU Development
 help / color / mirror / Atom feed
From: Jerry Snitselaar <jsnitsel@redhat.com>
To: Joerg Roedel <joro@8bytes.org>
Cc: iommu@lists.linux-foundation.org, jroedel@suse.de,
	David Woodhouse <dwmw2@infradead.org>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH 3/5 v2] iommu/vt-d: Do deferred attachment in iommu_need_mapping()
Date: Tue, 18 Feb 2020 08:53:11 -0700	[thread overview]
Message-ID: <20200218155311.kt6fd25odl2gzu2t@cantor> (raw)
In-Reply-To: <20200218092827.tp3pq67adzr56k7e@8bytes.org>

On Tue Feb 18 20, Joerg Roedel wrote:
>Hi Baolu,
>
>On Tue, Feb 18, 2020 at 10:38:14AM +0800, Lu Baolu wrote:
>> > diff --git a/drivers/iommu/intel-iommu.c b/drivers/iommu/intel-iommu.c
>> > index 42cdcce1602e..32f43695a22b 100644
>> > --- a/drivers/iommu/intel-iommu.c
>> > +++ b/drivers/iommu/intel-iommu.c
>> > @@ -2541,9 +2541,6 @@ static void do_deferred_attach(struct device *dev)
>> >   static struct dmar_domain *deferred_attach_domain(struct device *dev)
>> >   {
>> > -	if (unlikely(attach_deferred(dev)))
>> > -		do_deferred_attach(dev);
>> > -
>>
>> This should also be moved to the call place of deferred_attach_domain()
>> in bounce_map_single().
>>
>> bounce_map_single() assumes that devices always use DMA domain, so it
>> doesn't call iommu_need_mapping(). We could do_deferred_attach() there
>> manually.
>
>Good point, thanks for your review. Updated patch below.
>
>From 3a5b8a66d288d86ac1fd45092e7d96f842d0cccf Mon Sep 17 00:00:00 2001
>From: Joerg Roedel <jroedel@suse.de>
>Date: Mon, 17 Feb 2020 17:20:59 +0100
>Subject: [PATCH 3/5] iommu/vt-d: Do deferred attachment in
> iommu_need_mapping()
>
>The attachment of deferred devices needs to happen before the check
>whether the device is identity mapped or not. Otherwise the check will
>return wrong results, cause warnings boot failures in kdump kernels, like
>
>	WARNING: CPU: 0 PID: 318 at ../drivers/iommu/intel-iommu.c:592 domain_get_iommu+0x61/0x70
>
>	[...]
>
>	 Call Trace:
>	  __intel_map_single+0x55/0x190
>	  intel_alloc_coherent+0xac/0x110
>	  dmam_alloc_attrs+0x50/0xa0
>	  ahci_port_start+0xfb/0x1f0 [libahci]
>	  ata_host_start.part.39+0x104/0x1e0 [libata]
>
>With the earlier check the kdump boot succeeds and a crashdump is written.
>
>Signed-off-by: Joerg Roedel <jroedel@suse.de>

Reviewed-by: Jerry Snitselaar <jsnitsel@redhat.com>

_______________________________________________
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu

  parent reply	other threads:[~2020-02-18 15:53 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-17 19:38 [PATCH 0/5] iommu/vt-d: Fix kdump boot with VT-d enabled Joerg Roedel
2020-02-17 19:38 ` [PATCH 1/5] iommu/vt-d: Add attach_deferred() helper Joerg Roedel
2020-02-17 19:50   ` Jerry Snitselaar
2020-02-18 17:14   ` Christoph Hellwig
2020-02-19  9:29     ` Joerg Roedel
2020-02-17 19:38 ` [PATCH 2/5] iommu/vt-d: Move deferred device attachment into helper function Joerg Roedel
2020-02-17 19:50   ` Jerry Snitselaar
2020-02-18 17:16   ` Christoph Hellwig
2020-02-17 19:38 ` [PATCH 3/5] iommu/vt-d: Do deferred attachment in iommu_need_mapping() Joerg Roedel
2020-02-17 19:51   ` Jerry Snitselaar
2020-02-18  2:38   ` Lu Baolu
2020-02-18  9:28     ` [PATCH 3/5 v2] " Joerg Roedel
2020-02-18 11:54       ` Lu Baolu
2020-02-18 16:22         ` Joerg Roedel
2020-02-18 15:53       ` Jerry Snitselaar [this message]
2020-02-17 19:38 ` [PATCH 4/5] iommu/vt-d: Remove deferred_attach_domain() Joerg Roedel
2020-02-17 19:51   ` Jerry Snitselaar
2020-02-17 19:38 ` [PATCH 5/5] iommu/vt-d: Simplify check in identity_mapping() Joerg Roedel
2020-02-17 19:54   ` Jerry Snitselaar

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200218155311.kt6fd25odl2gzu2t@cantor \
    --to=jsnitsel@redhat.com \
    --cc=dwmw2@infradead.org \
    --cc=iommu@lists.linux-foundation.org \
    --cc=joro@8bytes.org \
    --cc=jroedel@suse.de \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox