- add "fixpae" bootparam to fix/workaround #930447
diff mbox

Message ID trinity-1045dd8c-e43f-4f8c-94e4-c0f0f15f611d-1385507362267@3capp-webde-bs36
State New
Headers show

Commit Message

Roland Nov. 26, 2013, 11:09 p.m. UTC
Hello kernel-team, 

regarding https://bugs.launchpad.net/ubuntu/+source/syslinux/+bug/930447 , i have developed a simple patch to (hopefully) provide an easy and elegant workaround/fix for the issue. I assume some hundred users (if not some thousand, as entries in bugreports are only the tip of an iceberg) are affected by this issue.

Please take a review and feel free to merge.

As defaulting to PAE kernels is specific for some distros only, i think this is no patch for mainline (yet).

I did not often do patches, nor am i a good programmer - so sorry if the patch or the submission style is not perfect.

regards
Roland

---
This patch adds a kernel bootparam "fixpae". If integrated into the kernel, this should make life more easy, as installation quirks like fake-pae package, upgrade path from ubuntu 12.04 onwards or specially crafted installation media are not needed anymore. Affected users also get a hint that their issue may be workarounded with this param. Just add the bootparam to the kernel commandline and you`re done.

       fixpae          [x86] Workaround for a nasty PAE issue with older CPU`s
                       like Pentium M, as they may report PAE incapability
                       although they support it. This bootparam adds a fake
                       pae entry to the flags section in /proc/cpuinfo and
                       skips the validate_cpu() routine in arch/x86/boot/main.c
                       This is necesssary as major distros nowadays only ship
                       PAE Kernels for x86 and there is no easy workaround.

signed-off-by: Roland Kletzing <devzero@web.de>
---

Comments

H. Peter Anvin Nov. 26, 2013, 11:33 p.m. UTC | #1
On 11/26/2013 03:09 PM, Roland Kletzing wrote:
> Hello kernel-team, 
> 
> regarding https://bugs.launchpad.net/ubuntu/+source/syslinux/+bug/930447 , i have developed a simple patch to (hopefully) provide an easy and elegant workaround/fix for the issue. I assume some hundred users (if not some thousand, as entries in bugreports are only the tip of an iceberg) are affected by this issue.
> 
> Please take a review and feel free to merge.
> 
> As defaulting to PAE kernels is specific for some distros only, i think this is no patch for mainline (yet).
> 
> I did not often do patches, nor am i a good programmer - so sorry if the patch or the submission style is not perfect.
> 
> regards
> Roland

No, this is not an acceptable patch per se.

The right way to do this is to have the option, if it is found, simply
set the bit in the CPU array.  However, it is important to verify that
we are on the affected type of CPU, specifically the affected Pentium Ms.

x86 patches should be sent to <x86@kernel.org> or equivalently myself,
<mingo@kernel.org> and <tglx@linutronix.de> and Cc:
<linux-kernel@vger.kernel.org>.  I also encourage you to read the file
Documentation/SubmittingPatches before trying again.

	-hpa
Roland Nov. 27, 2013, 8:41 p.m. UTC | #2
This patch is meant primarly for ubuntu, as they only ship PAE enabled 
kernels and don`t ship non-PAE kernels anymore.  So this resolves an ubuntu 
specific problem (as the installer disc also has PAE enabled kernel).

I know it`s not perfect, but poking cpu bits in arrays is above my skills 
and i have already spent really much time with this trying to resolve a 
problem for the end-user intruduced by nothing but the decision to 
discontinue Non-PAE kernels.

If grub2 can do nasty or ugly things like skipping standard x86 bootcode 
(which also skips validate_cpu() - while nobody seems to have a problem with 
that) , then i don`t understand what´s the real problem to add a very simple 
and unintrusive quirk to a vendor specific kernel.

Let time go by and the quirk will be obsolete one day anyway as no hardware 
lives forever.

But for now there exist distros like lubuntu meant for older hardware, and 
if installing that on a Pentium M 1,7 Ghz fails because of that nasty PAE 
issue nobody is willing to fix elegantly, then i think it deserves only one 
term:

planned obsolescence

I`s bad enough, that industry does produce products with limited lifetime. 
Products that break and that even can`t be repaired.

So please, kernel people, don`t think that way. Care for the users.

Many thinkpad users will be thankful if they can install their favourite 
distro by just adding a bootparam instead of reading through tons of pages 
how to add even weirder workarounds like bind-mounting a modified copy of 
itself on top of /proc/cpuinfo.

regards
Roland

ps:
https://help.ubuntu.com/community/Lubuntu-fake-PAE

--------------------------------------------------
From: "H. Peter Anvin" <hpa@zytor.com>
Sent: Wednesday, November 27, 2013 12:33 AM
To: "Roland Kletzing" <devzero@web.de>; <kernel-team@lists.ubuntu.com>
Cc: "Linux Kernel Mailing List" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] - add "fixpae" bootparam to fix/workaround #930447

> On 11/26/2013 03:09 PM, Roland Kletzing wrote:
>> Hello kernel-team,
>>
>> regarding https://bugs.launchpad.net/ubuntu/+source/syslinux/+bug/930447 
>> , i have developed a simple patch to (hopefully) provide an easy and 
>> elegant workaround/fix for the issue. I assume some hundred users (if not 
>> some thousand, as entries in bugreports are only the tip of an iceberg) 
>> are affected by this issue.
>>
>> Please take a review and feel free to merge.
>>
>> As defaulting to PAE kernels is specific for some distros only, i think 
>> this is no patch for mainline (yet).
>>
>> I did not often do patches, nor am i a good programmer - so sorry if the 
>> patch or the submission style is not perfect.
>>
>> regards
>> Roland
>
> No, this is not an acceptable patch per se.
>
> The right way to do this is to have the option, if it is found, simply
> set the bit in the CPU array.  However, it is important to verify that
> we are on the affected type of CPU, specifically the affected Pentium Ms.
>
> x86 patches should be sent to <x86@kernel.org> or equivalently myself,
> <mingo@kernel.org> and <tglx@linutronix.de> and Cc:
> <linux-kernel@vger.kernel.org>.  I also encourage you to read the file
> Documentation/SubmittingPatches before trying again.
>
> -hpa
>
Andy Whitcroft Nov. 29, 2013, 12:49 p.m. UTC | #3
On Wed, Nov 27, 2013 at 09:41:03PM +0100, Roland wrote:
> This patch is meant primarly for ubuntu, as they only ship PAE
> enabled kernels and don`t ship non-PAE kernels anymore.  So this
> resolves an ubuntu specific problem (as the installer disc also has
> PAE enabled kernel).
> 
> I know it`s not perfect, but poking cpu bits in arrays is above my
> skills and i have already spent really much time with this trying to
> resolve a problem for the end-user intruduced by nothing but the
> decision to discontinue Non-PAE kernels.

I think the complaints are more about how it works that the intent.
Kernel engineers are by their very nature very risk averse, so it would
indeed be good to set the bit correctly in the cpu capability flags, and
to do that based on the machine type.

I might just have a machine which exhibits this behaviour, I will try
and look it out and see if we can morph this into something appropriate.

-apw

Patch
diff mbox

diff -uprN linux-source-3.11.0.orig/arch/x86/boot/main.c linux-source-3.11.0/arch/x86/boot/main.c
--- linux-source-3.11.0.orig/arch/x86/boot/main.c       2013-09-02 22:46:10.000000000 +0200
+++ linux-source-3.11.0/arch/x86/boot/main.c    2013-11-26 20:56:01.175269235 +0100
@@ -146,9 +146,17 @@  void main(void)

        /* Make sure we have all the proper CPU support */
        if (validate_cpu()) {
-               puts("Unable to boot - please use a kernel appropriate "
-                    "for your CPU.\n");
-               die();
+               if(cmdline_find_option_bool("fixpae"))
+                       puts("fixpae bootparam active. Skipping CPU "
+                            "validation and continuing Kernel execution\n");
+               else {
+                       puts("Unable to boot - please use a kernel appropriate "
+                            "for your CPU.\n"
+                            "Hint: CPU`s like Pentium M may incorrectly report "
+                            "on PAE incapability, so you may try booting with "
+                            "fixpae bootparam as a workaround.\n");
+                       die();
+               }
        }

        /* Tell the BIOS what CPU mode we intend to run in. */
diff -uprN linux-source-3.11.0.orig/arch/x86/kernel/cpu/proc.c linux-source-3.11.0/arch/x86/kernel/cpu/proc.c
--- linux-source-3.11.0.orig/arch/x86/kernel/cpu/proc.c 2013-09-02 22:46:10.000000000 +0200
+++ linux-source-3.11.0/arch/x86/kernel/cpu/proc.c      2013-11-26 21:15:53.961267903 +0100
@@ -4,6 +4,17 @@ 
 #include <linux/seq_file.h>
 #include <linux/cpufreq.h>

+/* fixpae kernelparam workaround, see kernel-parameters.txt */
+static int fixpaeflag = 0;
+
+static int __init fixpae(char *s)
+{
+       fixpaeflag=1;
+        return 1;
+}
+
+__setup("fixpae", fixpae);
+
 /*
  *     Get CPU information for use by the procfs.
  */
@@ -96,6 +107,8 @@  static int show_cpuinfo(struct seq_file
        show_cpuinfo_misc(m, c);

        seq_printf(m, "flags\t\t:");
+       if(fixpaeflag)
+               seq_printf(m, " pae");
        for (i = 0; i < 32*NCAPINTS; i++)
                if (cpu_has(c, i) && x86_cap_flags[i] != NULL)
                        seq_printf(m, " %s", x86_cap_flags[i]);
diff -uprN linux-source-3.11.0.orig/Documentation/kernel-parameters.txt linux-source-3.11.0/Documentation/kernel-parameters.txt
--- linux-source-3.11.0.orig/Documentation/kernel-parameters.txt        2013-10-23 19:26:00.000000000 +0200
+++ linux-source-3.11.0/Documentation/kernel-parameters.txt     2013-11-26 21:13:28.515313678 +0100
@@ -900,6 +900,14 @@  bytes respectively. Such letter suffixes
                        Format: <interval>,<probability>,<space>,<times>
                        See also Documentation/fault-injection/.

+       fixpae          [x86] Workaround for a nasty PAE issue with older CPU`s
+                       like Pentium M, as they may report PAE incapability
+                       although they support it. This bootparam adds a fake
+                       pae entry to the flags section in /proc/cpuinfo and
+                       skips the validate_cpu() routine in arch/x86/boot/main.c
+                       This is necesssary as major distros nowadays only ship
+                       PAE Kernels for x86 and there is no easy workaround.
+
        floppy=         [HW]
                        See Documentation/blockdev/floppy.txt.