All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Uwe Kleine-König" <uwe@kleine-koenig.org>
To: Lu Baolu <baolu.lu@linux.intel.com>, Joerg Roedel <jroedel@suse.de>
Cc: linux-kernel@vger.kernel.org, rafael.j.wysocki@intel.com,
	tglx@linutronix.de, x86@kernel.org
Subject: Re: Failure to shutdown/reboot with intel_iommu=on
Date: Mon, 11 May 2020 22:16:56 +0200	[thread overview]
Message-ID: <20200511201656.GA2725@taurus.defre.kleine-koenig.org> (raw)
In-Reply-To: <11a3945a-f743-ac32-135c-1de026da66c9@kleine-koenig.org>

[-- Attachment #1: Type: text/plain, Size: 2210 bytes --]

Hello again,

On Mon, May 11, 2020 at 09:59:31PM +0200, Uwe Kleine-König wrote:
> On 5/9/20 3:58 AM, Lu Baolu wrote:
> > Hi Uwe,
> > 
> > Have you tried commenting out intel_disable_iommus() in
> > intel_iommu_shutdowan()?
> > 
> > diff --git a/drivers/iommu/intel-iommu.c b/drivers/iommu/intel-iommu.c
> > index 0182cff2c7ac..532e62600f95 100644
> > --- a/drivers/iommu/intel-iommu.c
> > +++ b/drivers/iommu/intel-iommu.c
> > @@ -4928,8 +4928,10 @@ void intel_iommu_shutdown(void)
> >         for_each_iommu(iommu, drhd)
> >                 iommu_disable_protect_mem_regions(iommu);
> > 
> > +#if 0
> >         /* Make sure the IOMMUs are switched off */
> >         intel_disable_iommus();
> > +#endif
> > 
> >         up_write(&dmar_global_lock);
> >  }
> 
> I just tested that and it didn't help. The machine still hangs with the
> same symptoms as reported before.

I patched the file a bit differently:

diff --git a/drivers/iommu/intel-iommu.c b/drivers/iommu/intel-iommu.c
index ef0a5246700e..b76acae6a6ac 100644
--- a/drivers/iommu/intel-iommu.c
+++ b/drivers/iommu/intel-iommu.c
@@ -4922,16 +4922,24 @@ void intel_iommu_shutdown(void)
 	if (no_iommu || dmar_disabled)
 		return;
 
+	pr_warn("%s:%d\n", __func__, __LINE__);
 	down_write(&dmar_global_lock);
 
+	pr_warn("%s:%d\n", __func__, __LINE__);
 	/* Disable PMRs explicitly here. */
-	for_each_iommu(iommu, drhd)
+	for_each_iommu(iommu, drhd) {
+		pr_warn("%s:%d\n", __func__, __LINE__);
 		iommu_disable_protect_mem_regions(iommu);
+		pr_warn("%s:%d\n", __func__, __LINE__);
+	}
 
+	pr_warn("%s:%d\n", __func__, __LINE__);
 	/* Make sure the IOMMUs are switched off */
 	intel_disable_iommus();
 
+	pr_warn("%s:%d\n", __func__, __LINE__);
 	up_write(&dmar_global_lock);
+	pr_warn("%s:%d\n", __func__, __LINE__);
 }
 
 static inline struct intel_iommu *dev_to_intel_iommu(struct device *dev)

and the output shows that the for_each_iommu loop runs twice and the
last pr_warn is reached, too. So the hang doesn't occur in
intel_iommu_shutdown() but later.

I don't know enough about x86 and iommus to judge what that means or
even if this was a useful test.

Best regards
Uwe

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

  reply	other threads:[~2020-05-11 20:17 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-06 14:46 Failure to shutdown/reboot with intel_iommu=on Uwe Kleine-König
2020-05-08 15:07 ` Joerg Roedel
2020-05-09  1:58   ` Lu Baolu
2020-05-11 19:59     ` Uwe Kleine-König
2020-05-11 20:16       ` Uwe Kleine-König [this message]
2020-05-11 13:43   ` Lenny Szubowicz
2020-05-11 19:58     ` Uwe Kleine-König
2020-05-12 13:34     ` Joerg Roedel
2020-05-12 20:00       ` Lenny Szubowicz
2020-05-12 21:13         ` Joerg Roedel

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=20200511201656.GA2725@taurus.defre.kleine-koenig.org \
    --to=uwe@kleine-koenig.org \
    --cc=baolu.lu@linux.intel.com \
    --cc=jroedel@suse.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rafael.j.wysocki@intel.com \
    --cc=tglx@linutronix.de \
    --cc=x86@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.