[lfs-support] Kernel bug involving physical to virtual remapping

Frans de Boer frans at fransdb.nl
Thu Jul 19 04:54:19 PDT 2018


On 07/17/2018 03:15 PM, Hazel Russman wrote:
> On Tue, 17 Jul 2018 14:06:09 +0200
> Frans de Boer <frans at fransdb.nl> wrote:
>
>> On 07/14/2018 06:56 PM, Hazel Russman wrote:
>>> Gentlemen,
>>>
>>> I was given your contact details by Michael Shell, who has been helping me to troubleshoot this problem via the Linux From Scratch support list.
>>>
>>> For some time now I have been unable to boot recent kernels (4.14 or later) on my rather elderly desktop machine. The kernel panics during boot and the problem seems (superficially) to lie in the acpi driver. At least that is where the visible error messages come from. Booting with "acpi=off" works but is hardly an ideal solution.
>>>
>>> However a git bisection showed that this is actually a memory management issue. The kernel commit that caused the problem is :
>>> [33c2b803edd13487518a2c7d5002d84d7e9c878f] x86/mm: Remove
>>> phys_to_virt() usage in ioremap().
>>>
>>> Reintroducing the code:
>>> "if (is_ISA_range(phys_addr, last_addr))
>>> 	return (__force void __iomem *)phys_to_virt(phys_addr);"
>>> makes the system bootable again. I have also tested this on a 4.15 kernel and it works there too.
>>>
>>> If you want me to carry out any further tests, I would be happy to oblige, but do please bear in mind that I am not an expert, so you will need to give fairly basic instructions.
>>>
>>> Hazel Russman
>>>
>>>   
>> Hazel, sorry but where should I remove phys_to_virt()? If I delete the
>> complete if statement in the iounmap function, and replace that with the
>> above code, i get compile errors.
>>
>> btw: acpi=off does not solve the issue too.
>>
>> Frans.
>>
>> -- 
> No, it's the other way around. phys_to_virt() doesn't get removed; it gets inserted/reinserted just above the warning not to let normal RAM be remapped. This is code that was in the kernel before but someone took it out and that was what was causing me all that trouble.
>
> Here's the patch that I made:
>   
> --- linux-4.13.0-rc1/arch/x86/mm/ioremap.c      2018-07-14 13:27:21.000000000 +0100
> +++ linux-4.13.0-rc1.new/arch/x86/mm/ioremap.c  2018-07-14 16:00:14.071456762 +0100
> @@ -103,7 +103,12 @@
>                         (unsigned long long)phys_addr);
>                  WARN_ON_ONCE(1);
>                  return NULL;
> -       }
> +       }
> +/* Don't remap the low PCI/ISA area, it's always mapped..
> +        */
> +       if (is_ISA_range(phys_addr, last_addr))
> +               return (__force void __iomem *)phys_to_virt(phys_addr);
> +
>   
>          /*
>           * Don't allow anybody to remap normal RAM that we're using..
>
> Sorry if this is a bit inexpert. I'm not used to creating patches and I did the actual edit by hand.
>
> I didn't touch anything else in that file. And it built normally with just that edit.

Hello Hazel,

What you inserted is already available as from the 4.13.0 release. But I 
can't compile 4.13. anymore because I now have gcc 8.1 instead of the 
former 7 series.

I continue my search and go for 4.14 where the check is removed. But i 
guess that will fail too and this is no solution to my problem with 
systemd freezing just after it found out that it is on a VM.

--- Frans



More information about the lfs-support mailing list