All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Zhao, Yu" <yu.zhao@intel.com>
To: Dirk Hohndel <hohndel@infradead.org>
Cc: "Han, Weidong" <weidong.han@intel.com>,
	"'Grant Grundler'" <grundler@parisc-linux.org>,
	"'linux-pci@vger.kernel.org'" <linux-pci@vger.kernel.org>,
	"'linux-kernel@vger.kernel.org'" <linux-kernel@vger.kernel.org>,
	"'Jesse Barnes'" <jbarnes@virtuousgeek.org>,
	"'iommu@lists.linux-foundation.org'" 
	<iommu@lists.linux-foundation.org>,
	"'Ingo Molnar'" <mingo@elte.hu>,
	"'Arjan van de Ven'" <arjan@infradead.org>
Subject: Re: git-latest: kernel oops in IOMMU setup
Date: Sat, 10 Jan 2009 00:16:22 +0800	[thread overview]
Message-ID: <49677856.90807@intel.com> (raw)
In-Reply-To: <20090109070805.525c0de9@infradead.org>

Dirk Hohndel wrote:
> On Fri, 9 Jan 2009 14:53:14 +0800
> "Han, Weidong" <weidong.han@intel.com> wrote:
> 
>> Dirk Hohndel wrote:
>>> On Thu, 8 Jan 2009 18:05:15 -0800
>>> Dirk Hohndel <hohndel@infradead.org> wrote:
>>>
>>>> On Fri, 9 Jan 2009 08:58:46 +0800 "Han, Weidong"
>>>>
>>>> I updated to Linus' latest git (as your description made me wonder
>>>> if the async stuff might play a role here). I still get an oops -
>>>> but at a different spot and the system no longer hangs - it partly
>>>> recovers (but things aren't too well - for example my USB
>>>> keyboard / mouse don't work anymore).
>>> Spoke too soon. Rebooted and had the same hard lockup again. This
>>> time I had my camera within reach, so here's the trace:
>>>
>>> device_to_iommu+0x33/0x73
>>> domain_context_mapping_one+0x37/0x335
>>> domain_context_mapping+0x25/0xa7
>>> iommu_prepare_identity+0xd7/0xf3
>>> intel_iommu_init+0x4e4/0x8f3
>>> ? mutex_lock
>>> ? sysctl_net_init
>>> ? pci_iommu_init
>>> pci_iommu_init
>>>
>>> I also have stack, code and register values. Let me know if you need
>>> them. Or I can just post the picture :-)
>>>
>>> Again, very latest git tree, VT-d enabled.
>>>
>>> /D
>> I tried latest git tree, it works for me. Above call trace looks
>> right. 
> 
> Spent some more time reading the code. Can't quite claim to understand
> all of it, yet, but I notice that most everywhere else drhd->devices[i]
> is checked to be != NULL before it is accessed. Why is it safe not to
> do that in device_to_iommu()?
> 
> Would the patch below be a valid fix? It stops my system from hanging at
> boot. But I wonder if there is an assertion that if drhd->ignored is 0
> then drhd->devices[0..drhd->device_cnt] is known to be != NULL and
> therefore this test is just hiding a bug somewhere else...
> 
> /D
> 
> Signed-off-by: Dirk Hohndel <hohndel@linux.intel.com>
> ---
>  drivers/pci/intel-iommu.c |    3 ++-
>  1 files changed, 2 insertions(+), 1 deletions(-)
> 
> diff --git a/drivers/pci/intel-iommu.c b/drivers/pci/intel-iommu.c
> index 235fb7a..3dfecb2 100644
> --- a/drivers/pci/intel-iommu.c
> +++ b/drivers/pci/intel-iommu.c
> @@ -438,7 +438,8 @@ static struct intel_iommu *device_to_iommu(u8 bus,
> u8 devfn) continue;
>  
>  		for (i = 0; i < drhd->devices_cnt; i++)
> -			if (drhd->devices[i]->bus->number == bus &&
> +			if (drhd->devices[i] &&
> +			    drhd->devices[i]->bus->number == bus &&
>  			    drhd->devices[i]->devfn == devfn)
>  				return drhd->iommu;
>  

Did you see following in the kernel message?
                 printk(KERN_WARNING PREFIX
                 "Device scope device [%04x:%02x:%02x.%02x] not found\n",
                 segment, scope->bus, path->dev, path->fn);

If yes, then
		Acked-by: Yu Zhao <yu.zhao@intel.com>

  reply	other threads:[~2009-01-09 16:16 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-01-08 20:05 git-latest: kernel oops in IOMMU setup Dirk Hohndel
2009-01-08 21:41 ` Grant Grundler
2009-01-08 21:56   ` Dirk Hohndel
2009-01-09  0:58   ` Han, Weidong
2009-01-09  2:05     ` Dirk Hohndel
2009-01-09  4:52       ` Dirk Hohndel
2009-01-09  6:53         ` Han, Weidong
2009-01-09 15:08           ` Dirk Hohndel
2009-01-09 16:16             ` Zhao, Yu [this message]
2009-01-09 16:34               ` Dirk Hohndel
2009-01-09 16:45                 ` Zhao, Yu
2009-01-09 16:55                   ` Dirk Hohndel
2009-01-09 16:58                   ` [PATCH] Prevent oops at boot with VT-d Dirk Hohndel
2009-01-11 15:25                     ` [Resend][PATCH] " Dirk Hohndel

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=49677856.90807@intel.com \
    --to=yu.zhao@intel.com \
    --cc=arjan@infradead.org \
    --cc=grundler@parisc-linux.org \
    --cc=hohndel@infradead.org \
    --cc=iommu@lists.linux-foundation.org \
    --cc=jbarnes@virtuousgeek.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=weidong.han@intel.com \
    /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.