Re: [PATCH] intel-iommu: don't call domain_exit if can not attach with iommu

Previous thread: [PATCH] oprofile: remove double ring buffering by Andi Kleen on Friday, March 19, 2010 - 5:03 pm. (3 messages)

Next thread: [PATCH] checkpatch: Add check for too short Kconfig descriptions by Andi Kleen on Friday, March 19, 2010 - 7:32 pm. (8 messages)
From: Yinghai Lu
Date: Friday, March 19, 2010 - 6:53 pm

when intel_iommu=off or iommu=pt is used, will work well.

eth304 ip=192.171.178.102 mac=56:95:16:88:4C:C1 pci=0000:0e:18.3 drv=ixgbevf
eth305 ip=192.171.179.102 mac=D6:41:8C:4A:87:B3 pci=0000:0e:18.5 drv=ixgbevf
[ 9534.886519] BUG: unable to handle kernel NULL pointer dereference at
0000000000000008
[ 9534.889775] IP: [<ffffffff813ddf94>] list_del+0xc/0x8b
[ 9534.889775] PGD e0660dd067 PUD e063a14067 PMD 0
[ 9534.889775] Oops: 0000 [#1] SMP
[ 9534.889775] last sysfs file:
/sys/devices/system/cpu/cpu0/cpufreq/related_cpus
[ 9534.889775] CPU 113
[ 9534.889775] Modules linked in:
[ 9534.889775]
[ 9534.889775] Pid: 28555, comm: ifconfig Not tainted
2.6.34-rc1-tip-yh-05104-g3af3b12-dirty #14   
[ 9534.889775] RIP: 0010:[<ffffffff813ddf94>]  [<ffffffff813ddf94>]
list_del+0xc/0x8b
[ 9534.889775] RSP: 0018:ffff88c070373af8  EFLAGS: 00010092
[ 9534.889775] RAX: 0000000000000296 RBX: 0000000000000000 RCX:
0000000000000000
[ 9534.889775] RDX: ffff88c0f140f940 RSI: ffffffff8237dc68 RDI:
0000000000000000
[ 9534.889775] RBP: ffff88c070373b08 R08: 0000000000000002 R09:
000000000044c295
[ 9534.889775] R10: 0000000000000000 R11: 0000000000000002 R12:
ffff88e063a81c00
[ 9534.889775] R13: ffff88e063a81c10 R14: 0000000000000000 R15:
0000000000000000
[ 9534.889775] FS:  00007f1bce8446f0(0000) GS:ffff88c0f1400000(0000)
knlGS:0000000000000000
[ 9534.889775] CS:  0010 DS: 0000 ES: 0000 CR0: 000000008005003b
[ 9534.889775] CR2: 0000000000000008 CR3: 000000e0639cb000 CR4:
00000000000006e0
[ 9534.889775] DR0: 0000000000000000 DR1: 0000000000000000 DR2:
0000000000000000
[ 9534.889775] DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7:
0000000000000400
[ 9534.889775] Process ifconfig (pid: 28555, threadinfo
ffff88c070372000, task ffff88c07254a350)
[ 9534.889775] Stack:
[ 9534.889775]  ffff88e063a81c00 0000000000000000 ffff88c070373b48
ffffffff81406a3d
[ 9534.889775] <0> 0000000000000006 0000000000000296 ffff88207fc13290
ffff88e063a81c00
[ 9534.889775] <0> ffff882070abd000 0000000000000000 ...
From: Yinghai Lu
Date: Saturday, March 20, 2010 - 3:21 am

when intel_iommu=off or iommu=pt is used, will work well.

root cause:
domain is initialized after trying attached it,

if it can not be attached, don't call domain_exit yet. it will cause kernel crash in domain_exit()

after patch will will get error instead of crash.

[ 1781.910241] IOMMU: no free domain ids
[ 1781.910244] Allocating domain for 0000:d0:1f.5 failed
SIOCSIFFLAGS: Cannot allocate memory


Signed-off-by: Yinghai Lu <yinghai@kernel.org>

Index: linux-2.6/drivers/pci/intel-iommu.c
===================================================================
--- linux-2.6.orig/drivers/pci/intel-iommu.c
+++ linux-2.6/drivers/pci/intel-iommu.c
@@ -1853,7 +1857,7 @@ static struct dmar_domain *get_domain_fo
 
 	ret = iommu_attach_domain(domain, iommu);
 	if (ret) {
-		domain_exit(domain);
+		free_domain_mem(domain);
 		goto error;
 	}
 
--

From: Jesse Brandeburg
Date: Monday, March 29, 2010 - 10:45 am

<added some cc>

If this patch fixes a bug can it be applied?  I hadn't seen any
followup, sorry if it was in another thread, I'm still catching up
after being out.

--

From: Jesse Barnes
Date: Thursday, April 8, 2010 - 9:49 am

Hopefully Ingo or David have picked this one up already?

Jesse

On Mon, 29 Mar 2010 10:45:31 -0700


-- 
Jesse Barnes, Intel Open Source Technology Center
--

From: Yinghai
Date: Thursday, April 8, 2010 - 10:58 am

No.

If you like, I could resend some other small clean patches for intel iommu/dmar to you.

Thanks

Yinghai
--

From: Chris Wright
Date: Thursday, April 8, 2010 - 11:04 am

Please do.  (Also, I could not reproduce the issue you saw).

thanks,
-chris
--

From: Yinghai
Date: Thursday, April 8, 2010 - 11:06 am

Will do that

you may need 8 or more intel 10g pcie cards, with ixgbe_vf enabled.

Thanks

Yinghai
--

From: Chris Wright
Date: Thursday, April 8, 2010 - 11:13 am

cards or VFs?

IOW, one dual port card can do something like 126 VFs + 2 PFs

thanks,
-chris
--

From: Yinghai
Date: Thursday, April 8, 2010 - 11:16 am

yes.

YH
--

From: Chris Wright
Date: Thursday, April 8, 2010 - 11:22 am

OK, got it, this makes much more sense.

thanks,
-chris
--

Previous thread: [PATCH] oprofile: remove double ring buffering by Andi Kleen on Friday, March 19, 2010 - 5:03 pm. (3 messages)

Next thread: [PATCH] checkpatch: Add check for too short Kconfig descriptions by Andi Kleen on Friday, March 19, 2010 - 7:32 pm. (8 messages)