All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] x86: move dmar_table_init out of enable_IR
@ 2009-08-17 17:53 Yinghai Lu
       [not found] ` <20090817180924.GA8599@elte.hu>
  0 siblings, 1 reply; 6+ messages in thread
From: Yinghai Lu @ 2009-08-17 17:53 UTC (permalink / raw)
  To: Ingo Molnar, Thomas Gleixner, H. Peter Anvin
  Cc: linux-kernel@vger.kernel.org, Peter Zijlstra, Gleb Natapov,
	Suresh Siddha, Pallipadi, Venkatesh


on x2apic system, we got
[    1.818072] ------------[ cut here ]------------
[    1.820376] WARNING: at kernel/lockdep.c:2461
lockdep_trace_alloc+0xa5/0xe9()
[    1.835282] Hardware name: ASSY,
[    1.839006] Modules linked in:
[    1.841253] Pid: 1, comm: swapper Not tainted
2.6.31-rc5-tip-03926-g39aaa80-dirty #510
[    1.858056] Call Trace:
[    1.859913]  [<ffffffff810d13aa>] ? lockdep_trace_alloc+0xa5/0xe9
[    1.876270]  [<ffffffff81093f37>] warn_slowpath_common+0x8d/0xd0
[    1.879132]  [<ffffffff81093fa1>] warn_slowpath_null+0x27/0x3d
[    1.896823]  [<ffffffff810d13aa>] lockdep_trace_alloc+0xa5/0xe9
[    1.900659]  [<ffffffff810cf5a0>] ? lock_release_holdtime+0x2f/0x199
[    1.917188]  [<ffffffff81167a3c>] kmem_cache_alloc_notrace+0x42/0x111
[    1.922320]  [<ffffffff8106fe8c>] ? reserve_memtype+0x152/0x518
[    1.938137]  [<ffffffff8106f8b1>] ? pat_pagerange_is_ram+0x4a/0x91
[    1.941730]  [<ffffffff8106fe8c>] reserve_memtype+0x152/0x518
[    1.958115]  [<ffffffff8106ce62>] __ioremap_caller+0x1dd/0x30f
[    1.975507]  [<ffffffff81ce2c5c>] ? acpi_os_map_memory+0x2a/0x47
[    1.978987]  [<ffffffff8106d0fd>] ioremap_nocache+0x2a/0x40
[    2.031400]  [<ffffffff810d0364>] ? trace_hardirqs_off+0x20/0x36
[    2.036096]  [<ffffffff81ce2c5c>] acpi_os_map_memory+0x2a/0x47
[    2.046263]  [<ffffffff815cd642>] acpi_tb_verify_table+0x3d/0x85
[    2.050349]  [<ffffffff81d34af7>] ? _spin_unlock_irqrestore+0x50/0x76
[    2.067327]  [<ffffffff815ccad6>] acpi_get_table_with_size+0x64/0xd9
[    2.070860]  [<ffffffff81d34af7>] ? _spin_unlock_irqrestore+0x50/0x76
[    2.088000]  [<ffffffff825c88d5>] dmar_table_detect+0x33/0x70
[    2.092047]  [<ffffffff825c8a01>] dmar_table_init+0x43/0x428
[    2.106854]  [<ffffffff825a7537>] enable_IR+0x1c/0x8d
[    2.110256]  [<ffffffff825a7624>] enable_IR_x2apic+0x7c/0x19e
[    2.127139]  [<ffffffff825a4876>] native_smp_prepare_cpus+0x139/0x3b8
[    2.145175]  [<ffffffff8259678d>] kernel_init+0x71/0x1da
[    2.148913]  [<ffffffff8104305a>] child_rip+0xa/0x20
[    2.152349]  [<ffffffff810429fc>] ? restore_args+0x0/0x30
[    2.167931]  [<ffffffff8259671c>] ? kernel_init+0x0/0x1da
[    2.171671]  [<ffffffff81043050>] ? child_rip+0x0/0x20
[    2.187607] ---[ end trace a7919e7f17c0a725 ]---

Pallipadi, Venkatesh said

| Looks like the problem started with this commit
|
| commit ce69a784504222c3ab6f1b3c357d09ec5772127a
|Author: Gleb Natapov <gleb@redhat.com>
|Date:   Mon Jul 20 15:24:17 2009 +0300
|
|x86/apic: Enable x2APIC without interrupt remapping under KVM
|
|Before this commit, dmar_table_init() was getting called with interrupts
|enabled and after this commit, it is getting called with interrupts
|disabled.

so try to move out dmar_table_init out of that function.

Analyzed-by: Venkatesh Pallipadi <venkatesh.pallipadi@intel.com>
Signed-off-by: Yinghai Lu <yinghai@kernel.org>

---
 arch/x86/kernel/apic/apic.c |   22 +++++++++++++---------
 1 file changed, 13 insertions(+), 9 deletions(-)

Index: linux-2.6/arch/x86/kernel/apic/apic.c
===================================================================
--- linux-2.6.orig/arch/x86/kernel/apic/apic.c
+++ linux-2.6/arch/x86/kernel/apic/apic.c
@@ -1365,14 +1365,6 @@ void enable_x2apic(void)
 int __init enable_IR(void)
 {
 #ifdef CONFIG_INTR_REMAP
-    int ret;
-
-    ret = dmar_table_init();
-    if (ret) {
-        pr_debug("dmar_table_init() failed with %d:\n", ret);
-        return 0;
-    }
-
     if (!intr_remapping_supported()) {
         pr_debug("intr-remapping not supported\n");
         return 0;
@@ -1400,6 +1392,14 @@ void __init enable_IR_x2apic(void)
     unsigned long flags;
     struct IO_APIC_route_entry **ioapic_entries = NULL;
     int ret, x2apic_enabled = 0;
+    int dmar_table_init_ret = 0;
+
+#ifdef CONFIG_INTR_REMAP
+    dmar_table_init_ret = dmar_table_init();
+    if (dmar_table_init_ret)
+        pr_debug("dmar_table_init() failed with %d:\n",
+                dmar_table_init_ret);
+#endif
 
     ioapic_entries = alloc_ioapic_entries();
     if (!ioapic_entries) {
@@ -1417,7 +1417,11 @@ void __init enable_IR_x2apic(void)
     mask_8259A();
     mask_IO_APIC_setup(ioapic_entries);
 
-    ret = enable_IR();
+    if (dmar_table_init_ret)
+        ret = 0;
+    else
+        ret = enable_IR();
+
     if (!ret) {
         /* IR is required if there is APIC ID > 255 even when running
          * under KVM

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH] x86: move dmar_table_init out of enable_IR
       [not found] ` <20090817180924.GA8599@elte.hu>
@ 2009-08-17 18:19   ` Yinghai Lu
  2009-08-17 18:33     ` Suresh Siddha
  2009-08-17 19:25     ` [tip:x86/apic] x86, apic: Move dmar_table_init() out of enable_IR() tip-bot for Yinghai Lu
  0 siblings, 2 replies; 6+ messages in thread
From: Yinghai Lu @ 2009-08-17 18:19 UTC (permalink / raw)
  To: Ingo Molnar, Thomas Gleixner, H. Peter Anvin
  Cc: linux-kernel@vger.kernel.org, Peter Zijlstra, Gleb Natapov,
	Suresh Siddha, Pallipadi, Venkatesh


on x2apic system, we got
[    1.818072] ------------[ cut here ]------------
[    1.820376] WARNING: at kernel/lockdep.c:2461 lockdep_trace_alloc+0xa5/0xe9()
[    1.835282] Hardware name: ASSY,
[    1.839006] Modules linked in:
[    1.841253] Pid: 1, comm: swapper Not tainted 2.6.31-rc5-tip-03926-g39aaa80-dirty #510
[    1.858056] Call Trace:
[    1.859913]  [<ffffffff810d13aa>] ? lockdep_trace_alloc+0xa5/0xe9
[    1.876270]  [<ffffffff81093f37>] warn_slowpath_common+0x8d/0xd0
[    1.879132]  [<ffffffff81093fa1>] warn_slowpath_null+0x27/0x3d
[    1.896823]  [<ffffffff810d13aa>] lockdep_trace_alloc+0xa5/0xe9
[    1.900659]  [<ffffffff810cf5a0>] ? lock_release_holdtime+0x2f/0x199
[    1.917188]  [<ffffffff81167a3c>] kmem_cache_alloc_notrace+0x42/0x111
[    1.922320]  [<ffffffff8106fe8c>] ? reserve_memtype+0x152/0x518
[    1.938137]  [<ffffffff8106f8b1>] ? pat_pagerange_is_ram+0x4a/0x91
[    1.941730]  [<ffffffff8106fe8c>] reserve_memtype+0x152/0x518
[    1.958115]  [<ffffffff8106ce62>] __ioremap_caller+0x1dd/0x30f
[    1.975507]  [<ffffffff81ce2c5c>] ? acpi_os_map_memory+0x2a/0x47
[    1.978987]  [<ffffffff8106d0fd>] ioremap_nocache+0x2a/0x40
[    2.031400]  [<ffffffff810d0364>] ? trace_hardirqs_off+0x20/0x36
[    2.036096]  [<ffffffff81ce2c5c>] acpi_os_map_memory+0x2a/0x47
[    2.046263]  [<ffffffff815cd642>] acpi_tb_verify_table+0x3d/0x85
[    2.050349]  [<ffffffff81d34af7>] ? _spin_unlock_irqrestore+0x50/0x76
[    2.067327]  [<ffffffff815ccad6>] acpi_get_table_with_size+0x64/0xd9
[    2.070860]  [<ffffffff81d34af7>] ? _spin_unlock_irqrestore+0x50/0x76
[    2.088000]  [<ffffffff825c88d5>] dmar_table_detect+0x33/0x70
[    2.092047]  [<ffffffff825c8a01>] dmar_table_init+0x43/0x428
[    2.106854]  [<ffffffff825a7537>] enable_IR+0x1c/0x8d
[    2.110256]  [<ffffffff825a7624>] enable_IR_x2apic+0x7c/0x19e
[    2.127139]  [<ffffffff825a4876>] native_smp_prepare_cpus+0x139/0x3b8
[    2.145175]  [<ffffffff8259678d>] kernel_init+0x71/0x1da
[    2.148913]  [<ffffffff8104305a>] child_rip+0xa/0x20
[    2.152349]  [<ffffffff810429fc>] ? restore_args+0x0/0x30
[    2.167931]  [<ffffffff8259671c>] ? kernel_init+0x0/0x1da
[    2.171671]  [<ffffffff81043050>] ? child_rip+0x0/0x20
[    2.187607] ---[ end trace a7919e7f17c0a725 ]---

Pallipadi, Venkatesh said

| Looks like the problem started with this commit
|
| commit ce69a784504222c3ab6f1b3c357d09ec5772127a
|Author: Gleb Natapov <gleb@redhat.com>
|Date:   Mon Jul 20 15:24:17 2009 +0300
|
|x86/apic: Enable x2APIC without interrupt remapping under KVM
|
|Before this commit, dmar_table_init() was getting called with interrupts
|enabled and after this commit, it is getting called with interrupts
|disabled.

so try to move out dmar_table_init out of that function.

Analyzed-by: Venkatesh Pallipadi <venkatesh.pallipadi@intel.com>
Signed-off-by: Yinghai Lu <yinghai@kernel.org>

---
 arch/x86/kernel/apic/apic.c |   22 +++++++++++++---------
 1 file changed, 13 insertions(+), 9 deletions(-)

Index: linux-2.6/arch/x86/kernel/apic/apic.c
===================================================================
--- linux-2.6.orig/arch/x86/kernel/apic/apic.c
+++ linux-2.6/arch/x86/kernel/apic/apic.c
@@ -1365,14 +1365,6 @@ void enable_x2apic(void)
 int __init enable_IR(void)
 {
 #ifdef CONFIG_INTR_REMAP
-	int ret;
-
-	ret = dmar_table_init();
-	if (ret) {
-		pr_debug("dmar_table_init() failed with %d:\n", ret);
-		return 0;
-	}
-
 	if (!intr_remapping_supported()) {
 		pr_debug("intr-remapping not supported\n");
 		return 0;
@@ -1400,6 +1392,14 @@ void __init enable_IR_x2apic(void)
 	unsigned long flags;
 	struct IO_APIC_route_entry **ioapic_entries = NULL;
 	int ret, x2apic_enabled = 0;
+	int dmar_table_init_ret = 0;
+
+#ifdef CONFIG_INTR_REMAP
+	dmar_table_init_ret = dmar_table_init();
+	if (dmar_table_init_ret)
+		pr_debug("dmar_table_init() failed with %d:\n",
+				dmar_table_init_ret);
+#endif
 
 	ioapic_entries = alloc_ioapic_entries();
 	if (!ioapic_entries) {
@@ -1417,7 +1417,11 @@ void __init enable_IR_x2apic(void)
 	mask_8259A();
 	mask_IO_APIC_setup(ioapic_entries);
 
-	ret = enable_IR();
+	if (dmar_table_init_ret)
+		ret = 0;
+	else
+		ret = enable_IR();
+
 	if (!ret) {
 		/* IR is required if there is APIC ID > 255 even when running
 		 * under KVM


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] x86: move dmar_table_init out of enable_IR
  2009-08-17 18:19   ` Yinghai Lu
@ 2009-08-17 18:33     ` Suresh Siddha
  2009-08-17 20:47       ` Yinghai Lu
  2009-08-17 19:25     ` [tip:x86/apic] x86, apic: Move dmar_table_init() out of enable_IR() tip-bot for Yinghai Lu
  1 sibling, 1 reply; 6+ messages in thread
From: Suresh Siddha @ 2009-08-17 18:33 UTC (permalink / raw)
  To: Yinghai Lu
  Cc: Ingo Molnar, Thomas Gleixner, H. Peter Anvin,
	linux-kernel@vger.kernel.org, Peter Zijlstra, Gleb Natapov,
	Pallipadi, Venkatesh

On Mon, 2009-08-17 at 11:19 -0700, Yinghai Lu wrote:
> ---
>  arch/x86/kernel/apic/apic.c |   22 +++++++++++++---------
>  1 file changed, 13 insertions(+), 9 deletions(-)
> 
> Index: linux-2.6/arch/x86/kernel/apic/apic.c
> ===================================================================
> --- linux-2.6.orig/arch/x86/kernel/apic/apic.c
> +++ linux-2.6/arch/x86/kernel/apic/apic.c
> @@ -1365,14 +1365,6 @@ void enable_x2apic(void)
>  int __init enable_IR(void)
>  {
>  #ifdef CONFIG_INTR_REMAP
> -	int ret;
> -
> -	ret = dmar_table_init();
> -	if (ret) {
> -		pr_debug("dmar_table_init() failed with %d:\n", ret);
> -		return 0;
> -	}
> -
>  	if (!intr_remapping_supported()) {
>  		pr_debug("intr-remapping not supported\n");
>  		return 0;
> @@ -1400,6 +1392,14 @@ void __init enable_IR_x2apic(void)
>  	unsigned long flags;
>  	struct IO_APIC_route_entry **ioapic_entries = NULL;
>  	int ret, x2apic_enabled = 0;
> +	int dmar_table_init_ret = 0;
> +
> +#ifdef CONFIG_INTR_REMAP
> +	dmar_table_init_ret = dmar_table_init();
> +	if (dmar_table_init_ret)
> +		pr_debug("dmar_table_init() failed with %d:\n",
> +				dmar_table_init_ret);
> +#endif

We can remove this ifdef check, as dmar_table_init() already handles
the !config_intr_remap

Also, at this error condition, we should simply return if the cpu has no
x2apic support. There is no x2apic support and we failed to enable
interrupt-remapping. No need to go further down.

thanks,
suresh

>  
>  	ioapic_entries = alloc_ioapic_entries();
>  	if (!ioapic_entries) {
> @@ -1417,7 +1417,11 @@ void __init enable_IR_x2apic(void)
>  	mask_8259A();
>  	mask_IO_APIC_setup(ioapic_entries);
>  
> -	ret = enable_IR();
> +	if (dmar_table_init_ret)
> +		ret = 0;
> +	else
> +		ret = enable_IR();
> +
>  	if (!ret) {
>  		/* IR is required if there is APIC ID > 255 even when running
>  		 * under KVM
> 


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [tip:x86/apic] x86, apic: Move dmar_table_init() out of enable_IR()
  2009-08-17 18:19   ` Yinghai Lu
  2009-08-17 18:33     ` Suresh Siddha
@ 2009-08-17 19:25     ` tip-bot for Yinghai Lu
  1 sibling, 0 replies; 6+ messages in thread
From: tip-bot for Yinghai Lu @ 2009-08-17 19:25 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, hpa, mingo, yinghai, peterz, venkatesh.pallipadi,
	gleb, suresh.b.siddha, tglx, mingo

Commit-ID:  b7f42ab2e237f08a5bbcefa17473e80eb05e725c
Gitweb:     http://git.kernel.org/tip/b7f42ab2e237f08a5bbcefa17473e80eb05e725c
Author:     Yinghai Lu <yinghai@kernel.org>
AuthorDate: Mon, 17 Aug 2009 11:19:40 -0700
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Mon, 17 Aug 2009 20:22:56 +0200

x86, apic: Move dmar_table_init() out of enable_IR()

On an x2apic system, we got:

[    1.818072] ------------[ cut here ]------------
[    1.820376] WARNING: at kernel/lockdep.c:2461 lockdep_trace_alloc+0xa5/0xe9()
[    1.835282] Hardware name: ASSY,
[    1.839006] Modules linked in:
[    1.841253] Pid: 1, comm: swapper Not tainted 2.6.31-rc5-tip-03926-g39aaa80-dirty #510
[    1.858056] Call Trace:
[    1.859913]  [<ffffffff810d13aa>] ? lockdep_trace_alloc+0xa5/0xe9
[    1.876270]  [<ffffffff81093f37>] warn_slowpath_common+0x8d/0xd0
[    1.879132]  [<ffffffff81093fa1>] warn_slowpath_null+0x27/0x3d
[    1.896823]  [<ffffffff810d13aa>] lockdep_trace_alloc+0xa5/0xe9
[    1.900659]  [<ffffffff810cf5a0>] ? lock_release_holdtime+0x2f/0x199
[    1.917188]  [<ffffffff81167a3c>] kmem_cache_alloc_notrace+0x42/0x111
[    1.922320]  [<ffffffff8106fe8c>] ? reserve_memtype+0x152/0x518
[    1.938137]  [<ffffffff8106f8b1>] ? pat_pagerange_is_ram+0x4a/0x91
[    1.941730]  [<ffffffff8106fe8c>] reserve_memtype+0x152/0x518
[    1.958115]  [<ffffffff8106ce62>] __ioremap_caller+0x1dd/0x30f
[    1.975507]  [<ffffffff81ce2c5c>] ? acpi_os_map_memory+0x2a/0x47
[    1.978987]  [<ffffffff8106d0fd>] ioremap_nocache+0x2a/0x40
[    2.031400]  [<ffffffff810d0364>] ? trace_hardirqs_off+0x20/0x36
[    2.036096]  [<ffffffff81ce2c5c>] acpi_os_map_memory+0x2a/0x47
[    2.046263]  [<ffffffff815cd642>] acpi_tb_verify_table+0x3d/0x85
[    2.050349]  [<ffffffff81d34af7>] ? _spin_unlock_irqrestore+0x50/0x76
[    2.067327]  [<ffffffff815ccad6>] acpi_get_table_with_size+0x64/0xd9
[    2.070860]  [<ffffffff81d34af7>] ? _spin_unlock_irqrestore+0x50/0x76
[    2.088000]  [<ffffffff825c88d5>] dmar_table_detect+0x33/0x70
[    2.092047]  [<ffffffff825c8a01>] dmar_table_init+0x43/0x428
[    2.106854]  [<ffffffff825a7537>] enable_IR+0x1c/0x8d
[    2.110256]  [<ffffffff825a7624>] enable_IR_x2apic+0x7c/0x19e
[    2.127139]  [<ffffffff825a4876>] native_smp_prepare_cpus+0x139/0x3b8
[    2.145175]  [<ffffffff8259678d>] kernel_init+0x71/0x1da
[    2.148913]  [<ffffffff8104305a>] child_rip+0xa/0x20
[    2.152349]  [<ffffffff810429fc>] ? restore_args+0x0/0x30
[    2.167931]  [<ffffffff8259671c>] ? kernel_init+0x0/0x1da
[    2.171671]  [<ffffffff81043050>] ? child_rip+0x0/0x20
[    2.187607] ---[ end trace a7919e7f17c0a725 ]---

Venkatesh Pallipadi said:

| Looks like the problem started with this commit
|
| commit ce69a784504222c3ab6f1b3c357d09ec5772127a
| Author: Gleb Natapov <gleb@redhat.com>
| Date:   Mon Jul 20 15:24:17 2009 +0300
|
| x86/apic: Enable x2APIC without interrupt remapping under KVM
|
| Before this commit, dmar_table_init() was getting called
| with interrupts enabled and after this commit, it is getting
| called with interrupts disabled.

so try to move out dmar_table_init out of that function.

Analyzed-by: Venkatesh Pallipadi <venkatesh.pallipadi@intel.com>
Signed-off-by: Yinghai Lu <yinghai@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Gleb Natapov <gleb@redhat.com>
Cc: Suresh Siddha <suresh.b.siddha@intel.com>
Cc: "Pallipadi, Venkatesh" <venkatesh.pallipadi@intel.com>
LKML-Reference: <4A899F3C.2050104@kernel.org>
Signed-off-by: Ingo Molnar <mingo@elte.hu>


---
 arch/x86/kernel/apic/apic.c |   22 +++++++++++++---------
 1 files changed, 13 insertions(+), 9 deletions(-)

diff --git a/arch/x86/kernel/apic/apic.c b/arch/x86/kernel/apic/apic.c
index de039fc..3fc3a6c 100644
--- a/arch/x86/kernel/apic/apic.c
+++ b/arch/x86/kernel/apic/apic.c
@@ -1365,14 +1365,6 @@ void enable_x2apic(void)
 int __init enable_IR(void)
 {
 #ifdef CONFIG_INTR_REMAP
-	int ret;
-
-	ret = dmar_table_init();
-	if (ret) {
-		pr_debug("dmar_table_init() failed with %d:\n", ret);
-		return 0;
-	}
-
 	if (!intr_remapping_supported()) {
 		pr_debug("intr-remapping not supported\n");
 		return 0;
@@ -1400,6 +1392,14 @@ void __init enable_IR_x2apic(void)
 	unsigned long flags;
 	struct IO_APIC_route_entry **ioapic_entries = NULL;
 	int ret, x2apic_enabled = 0;
+	int dmar_table_init_ret = 0;
+
+#ifdef CONFIG_INTR_REMAP
+	dmar_table_init_ret = dmar_table_init();
+	if (dmar_table_init_ret)
+		pr_debug("dmar_table_init() failed with %d:\n",
+				dmar_table_init_ret);
+#endif
 
 	ioapic_entries = alloc_ioapic_entries();
 	if (!ioapic_entries) {
@@ -1417,7 +1417,11 @@ void __init enable_IR_x2apic(void)
 	mask_8259A();
 	mask_IO_APIC_setup(ioapic_entries);
 
-	ret = enable_IR();
+	if (dmar_table_init_ret)
+		ret = 0;
+	else
+		ret = enable_IR();
+
 	if (!ret) {
 		/* IR is required if there is APIC ID > 255 even when running
 		 * under KVM

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH] x86: move dmar_table_init out of enable_IR
  2009-08-17 18:33     ` Suresh Siddha
@ 2009-08-17 20:47       ` Yinghai Lu
  2009-08-17 22:53         ` Suresh Siddha
  0 siblings, 1 reply; 6+ messages in thread
From: Yinghai Lu @ 2009-08-17 20:47 UTC (permalink / raw)
  To: Suresh Siddha
  Cc: Ingo Molnar, Thomas Gleixner, H. Peter Anvin,
	linux-kernel@vger.kernel.org, Peter Zijlstra, Gleb Natapov,
	Pallipadi, Venkatesh

Suresh Siddha wrote:
> On Mon, 2009-08-17 at 11:19 -0700, Yinghai Lu wrote:
>> ---
>>  arch/x86/kernel/apic/apic.c |   22 +++++++++++++---------
>>  1 file changed, 13 insertions(+), 9 deletions(-)
>>
>> Index: linux-2.6/arch/x86/kernel/apic/apic.c
>> ===================================================================
>> --- linux-2.6.orig/arch/x86/kernel/apic/apic.c
>> +++ linux-2.6/arch/x86/kernel/apic/apic.c
>> @@ -1365,14 +1365,6 @@ void enable_x2apic(void)
>>  int __init enable_IR(void)
>>  {
>>  #ifdef CONFIG_INTR_REMAP
>> -	int ret;
>> -
>> -	ret = dmar_table_init();
>> -	if (ret) {
>> -		pr_debug("dmar_table_init() failed with %d:\n", ret);
>> -		return 0;
>> -	}
>> -
>>  	if (!intr_remapping_supported()) {
>>  		pr_debug("intr-remapping not supported\n");
>>  		return 0;
>> @@ -1400,6 +1392,14 @@ void __init enable_IR_x2apic(void)
>>  	unsigned long flags;
>>  	struct IO_APIC_route_entry **ioapic_entries = NULL;
>>  	int ret, x2apic_enabled = 0;
>> +	int dmar_table_init_ret = 0;
>> +
>> +#ifdef CONFIG_INTR_REMAP
>> +	dmar_table_init_ret = dmar_table_init();
>> +	if (dmar_table_init_ret)
>> +		pr_debug("dmar_table_init() failed with %d:\n",
>> +				dmar_table_init_ret);
>> +#endif
> 
> We can remove this ifdef check, as dmar_table_init() already handles
> the !config_intr_remap
> 
> Also, at this error condition, we should simply return if the cpu has no
> x2apic support. There is no x2apic support and we failed to enable
> interrupt-remapping. No need to go further down.

like this ?

---
 arch/x86/kernel/apic/apic.c |    9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

Index: linux-2.6/arch/x86/kernel/apic/apic.c
===================================================================
--- linux-2.6.orig/arch/x86/kernel/apic/apic.c
+++ linux-2.6/arch/x86/kernel/apic/apic.c
@@ -1392,14 +1392,11 @@ void __init enable_IR_x2apic(void)
 	unsigned long flags;
 	struct IO_APIC_route_entry **ioapic_entries = NULL;
 	int ret, x2apic_enabled = 0;
-	int dmar_table_init_ret = 0;
+	int dmar_table_init_ret;
 
-#ifdef CONFIG_INTR_REMAP
 	dmar_table_init_ret = dmar_table_init();
-	if (dmar_table_init_ret)
-		pr_debug("dmar_table_init() failed with %d:\n",
-				dmar_table_init_ret);
-#endif
+	if (dmar_table_init_ret && !x2apic_supported())
+		return;
 
 	ioapic_entries = alloc_ioapic_entries();
 	if (!ioapic_entries) {




^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] x86: move dmar_table_init out of enable_IR
  2009-08-17 20:47       ` Yinghai Lu
@ 2009-08-17 22:53         ` Suresh Siddha
  0 siblings, 0 replies; 6+ messages in thread
From: Suresh Siddha @ 2009-08-17 22:53 UTC (permalink / raw)
  To: Yinghai Lu
  Cc: Ingo Molnar, Thomas Gleixner, H. Peter Anvin,
	linux-kernel@vger.kernel.org, Peter Zijlstra, Gleb Natapov,
	Pallipadi, Venkatesh

On Mon, 2009-08-17 at 13:47 -0700, Yinghai Lu wrote:
> Suresh Siddha wrote:
> > 
> > We can remove this ifdef check, as dmar_table_init() already handles
> > the !config_intr_remap
> > 
> > Also, at this error condition, we should simply return if the cpu has no
> > x2apic support. There is no x2apic support and we failed to enable
> > interrupt-remapping. No need to go further down.
> 
> like this ?
> 
> ---
>  arch/x86/kernel/apic/apic.c |    9 +++------
>  1 file changed, 3 insertions(+), 6 deletions(-)
> 
> Index: linux-2.6/arch/x86/kernel/apic/apic.c
> ===================================================================
> --- linux-2.6.orig/arch/x86/kernel/apic/apic.c
> +++ linux-2.6/arch/x86/kernel/apic/apic.c
> @@ -1392,14 +1392,11 @@ void __init enable_IR_x2apic(void)
>  	unsigned long flags;
>  	struct IO_APIC_route_entry **ioapic_entries = NULL;
>  	int ret, x2apic_enabled = 0;
> -	int dmar_table_init_ret = 0;
> +	int dmar_table_init_ret;
>  
> -#ifdef CONFIG_INTR_REMAP
>  	dmar_table_init_ret = dmar_table_init();
> -	if (dmar_table_init_ret)
> -		pr_debug("dmar_table_init() failed with %d:\n",
> -				dmar_table_init_ret);
> -#endif
> +	if (dmar_table_init_ret && !x2apic_supported())
> +		return;
>  
>  	ioapic_entries = alloc_ioapic_entries();
>  	if (!ioapic_entries) {

Ack.


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2009-08-17 22:54 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-08-17 17:53 [PATCH] x86: move dmar_table_init out of enable_IR Yinghai Lu
     [not found] ` <20090817180924.GA8599@elte.hu>
2009-08-17 18:19   ` Yinghai Lu
2009-08-17 18:33     ` Suresh Siddha
2009-08-17 20:47       ` Yinghai Lu
2009-08-17 22:53         ` Suresh Siddha
2009-08-17 19:25     ` [tip:x86/apic] x86, apic: Move dmar_table_init() out of enable_IR() tip-bot for Yinghai Lu

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.