lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Fri, 16 Jan 2015 12:10:19 +0100
From:	Borislav Petkov <bp@...en8.de>
To:	Thomas Gleixner <tglx@...utronix.de>
Cc:	LKML <linux-kernel@...r.kernel.org>,
	Jiang Liu <jiang.liu@...ux.intel.com>,
	Joerg Roedel <joro@...tes.org>, x86@...nel.org,
	Tony Luck <tony.luck@...el.com>
Subject: Re: [patch 04/23] x86/ioapic: Check x2apic really

On Thu, Jan 15, 2015 at 09:22:14PM -0000, Thomas Gleixner wrote:
> The x2apic_preenabled flag is just a horrible hack and if X2APIC
> support is disabled it does not reflect the actual hardware
> state. Check the hardware instead.
> 
> Signed-off-by: Thomas Gleixner <tglx@...utronix.de>
> ---
>  arch/x86/include/asm/apic.h    |    2 --
>  arch/x86/kernel/apic/apic.c    |    4 +++-
>  arch/x86/kernel/apic/io_apic.c |    2 +-
>  3 files changed, 4 insertions(+), 4 deletions(-)
> 
> Index: tip/arch/x86/include/asm/apic.h
> ===================================================================
> --- tip.orig/arch/x86/include/asm/apic.h
> +++ tip/arch/x86/include/asm/apic.h
> @@ -177,7 +177,6 @@ static inline u64 native_x2apic_icr_read
>  
>  extern int x2apic_mode;
>  extern int x2apic_phys;
> -extern int x2apic_preenabled;
>  extern void check_x2apic(void);
>  extern void enable_x2apic(void);
>  static inline int x2apic_enabled(void)
> @@ -209,7 +208,6 @@ static inline void x2apic_force_phys(voi
>  }
>  
>  #define x2apic_mode		(0)
> -#define	x2apic_preenabled	(0)
>  #define	x2apic_supported()	(0)
>  #endif
>  
> Index: tip/arch/x86/kernel/apic/apic.c
> ===================================================================
> --- tip.orig/arch/x86/kernel/apic/apic.c
> +++ tip/arch/x86/kernel/apic/apic.c
> @@ -1480,7 +1480,7 @@ static bool nox2apic __initdata;
>  #ifdef CONFIG_X86_X2APIC
>  int x2apic_mode;
>  /* x2apic enabled before OS handover */
> -int x2apic_preenabled;
> +static int x2apic_preenabled;

Bah, let's get rid of this knob completely (ontop of your patch):

---
Index: b/arch/x86/kernel/apic/apic.c
===================================================================
--- a/arch/x86/kernel/apic/apic.c	2015-01-16 12:09:08.116801555 +0100
+++ b/arch/x86/kernel/apic/apic.c	2015-01-16 12:08:41.004802076 +0100
@@ -1480,7 +1480,6 @@ static bool nox2apic __initdata;
 #ifdef CONFIG_X86_X2APIC
 int x2apic_mode;
 /* x2apic enabled before OS handover */
-static int x2apic_preenabled;
 static int x2apic_disabled;
 static int __init setup_nox2apic(char *str)
 {
@@ -1546,7 +1545,7 @@ void check_x2apic(void)
 {
 	if (x2apic_enabled()) {
 		pr_info("x2apic enabled by BIOS, switching to x2apic ops\n");
-		x2apic_preenabled = x2apic_mode = 1;
+		x2apic_mode = 1;
 	}
 }
 
@@ -1570,7 +1569,6 @@ void enable_x2apic(void)
 	}
 }
 #else
-#define x2apic_preenabled	(0)
 #endif /* CONFIG_X86_X2APIC */
 
 static int __init try_to_enable_IR(void)
@@ -1599,7 +1597,7 @@ static __init void try_to_enable_x2apic(
 		    (IS_ENABLED(CONFIG_HYPERVISOR_GUEST) &&
 		     !hypervisor_x2apic_available())) {
 			pr_info("IRQ remapping doesn't support X2APIC mode, disable x2apic.\n");
-			if (x2apic_preenabled)
+			if (x2apic_enabled())
 				disable_x2apic();
 			return;
 		}
@@ -1643,7 +1641,7 @@ void __init enable_IR_x2apic(void)
 	legacy_pic->mask_all();
 	mask_ioapic_entries();
 
-	if (x2apic_preenabled && nox2apic)
+	if (x2apic_enabled() && nox2apic)
 		disable_x2apic();
 	/* If irq_remapping_prepare() succeded, try to enable it */
 	if (ir_stat >= 0)
--

-- 
Regards/Gruss,
    Boris.

Sent from a fat crate under my desk. Formatting is fine.
--
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ