Skip to contentSkip to conversation

ARM: Disable outer cache before kexec call -V3

PATCH New Thomas Gleixner 7 participants 13 messages Jul 5, 2010 – Aug 6, 2010

lore
Share & tools
lore
#0 lore raw

cover ARM: Disable outer cache before kexec call -V3

The following patch series addresses the problem that the kexec code does not disable the outer cache before disabling the inner cache and jumping into the new kernel. This results in random crashes of the new kernel.

Changes since version 2:

- Use CLEAN_INV_WAY in l2x0_flush_all according to Catalin

- Rename outer_cache_disable() to outer_disable()

- Added a BUG_ON() when l2x0_inv_all() is called with L2 enabled.

Thanks,

tglx

#2 lore raw

PATCH 1/2 arm: Disable outer (L2) cache in kexec

Quoted 11 lines · Thomas Gleixner

kexec does not disable the outer cache before disabling the inner caches in cpu_proc_fin(). So L2 is enabled across the kexec jump. When the new kernel enables chaches again, it randomly crashes.

Disabling L2 before calling cpu_proc_fin() cures the problem.

Disabling L2 requires the following new functions: flush_all(), inv_all() and disable(). Add them to outer_cache_fns and call them from the kexec code.

Signature · 1 line
Catalin
#4 lore raw

PATCH 2/2 arm: Implement l2x0 cache disable functions

Quoted 8 lines · Thomas Gleixner

Add flush_all, inv_all and disable functions to the l2x0 code. These functions are called from kexec code to prevent random crashes in the new kernel.

Platforms like OMAP which control L2 enable/disable via SMI mode can override the outer_cache.disable() function to implement their own.

[...]

Review

Quoted 6 lines
(quoted diff) +5 -1
-static inline void l2x0_inv_all(void)
+static void l2x0_flush_all(void)
+{
+       unsigned long flags;
+
+       /* clean all ways */

Minor point - /* clean and invalidate all ways */

But the patch looks good to me:

Signature · 1 line
Catalin
#5 lore raw

PATCH 2/2 arm: Implement l2x0 cache disable functions

In reply to Thomas Gleixner

2010/7/5 Thomas Gleixner <[email protected]>:

Review

Quoted 13 lines

Add flush_all, inv_all and disable functions to the l2x0 code. These functions are called from kexec code to prevent random crashes in the new kernel.
(...)

(quoted diff) +9 -0
+static void l2x0_disable(void)
+{
+ ? ? ? unsigned long flags;
+
+ ? ? ? spin_lock_irqsave(&l2x0_lock, flags);
+ ? ? ? writel(0, l2x0_base + L2X0_CTRL);
+ ? ? ? spin_unlock_irqrestore(&l2x0_lock, flags);
+}
+

Does this take into account this comment from Srinidhi:

[Srinidhi KASAGAR wrote]

Quoted 2 lines

I think it's a problem for PL310 controller where the access to L2X0_CTRL is secure, accessing this in non-secure mode will fault.

I'm worried that a writel() into the CTRL register like that will cause a bus error on platforms that have L2x0 in Trusted World (TrustZone)? Or that it may be ignored simply on such platforms causing trouble that way?

Yours,
Linus Walleij

#6 lore raw

cover ARM: Disable outer cache before kexec call -V3

In reply to Thomas Gleixner

Hi,
I have applied your patches to kernel 2.6.35-rc4 running on my
beagleboard.
I'm using kexec-tools-2.0.1.

My u-boot bootargs is:

     console=ttyS2,115200n8 root=/dev/mmcblk0p2 rw rootfstype=ext3 

rootwait ip=192.168.2.13::255.255.255.0

To restart the system I type:

Quoted 2 lines

sync
kexec -l /boot/zImage --append="console=ttyS2,115200n8

root=/dev/mmcblk0p2 rw rootfstype=ext3 rootwait
ip=192.168.2.13::255.255.255.0"

Quoted 1 line

kexec -e

Not every time the system restart.
In some cases no output on the console after the following:
Bye!
Uncompressing Linux... done, booting the kernel.

Any idea?

Regards,
Andrea

Il 05/07/2010 13.52, Thomas Gleixner ha scritto:

Quoted 25 lines

The following patch series addresses the problem that the kexec code does not disable the outer cache before disabling the inner cache and jumping into the new kernel. This results in random crashes of the new kernel.

Changes since version 2:

- Use CLEAN_INV_WAY in l2x0_flush_all according to Catalin

- Rename outer_cache_disable() to outer_disable()

- Added a BUG_ON() when l2x0_inv_all() is called with L2 enabled.

Thanks,

tglx

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel at lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

#7 lore raw

cover ARM: Disable outer cache before kexec call -V3

Quoted 12 lines · Andrea Paterniani

Hi,
I have applied your patches to kernel 2.6.35-rc4 running on my beagleboard.
I'm using kexec-tools-2.0.1.

My u-boot bootargs is:

     console=ttyS2,115200n8 root=/dev/mmcblk0p2 rw rootfstype=ext3 rootwait ip=192.168.2.13::255.255.255.0

To restart the system I type:

Quoted 3 lines

sync
kexec -l /boot/zImage --append="console=ttyS2,115200n8 root=/dev/mmcblk0p2 rw rootfstype=ext3 rootwait ip=192.168.2.13::255.255.255.0" kexec -e

Quoted 7 lines

Not every time the system restart.
In some cases no output on the console after the following:
Bye!
Uncompressing Linux... done, booting the kernel.

Any idea?

Can you try building your kernel with CONFIG_EARLY_PRINTK, and add the word "earlyprintk" to your bootargs?

Quoted 20 lines

Il 05/07/2010 13.52, Thomas Gleixner ha scritto:

Quoted 19 lines

The following patch series addresses the problem that the kexec code does not disable the outer cache before disabling the inner cache and jumping into the new kernel. This results in random crashes of the new kernel.

Changes since version 2:

- Use CLEAN_INV_WAY in l2x0_flush_all according to Catalin

- Rename outer_cache_disable() to outer_disable()

- Added a BUG_ON() when l2x0_inv_all() is called with L2 enabled.

Thanks,

tglx

#8 lore raw

cover ARM: Disable outer cache before kexec call -V3

Il 03/08/2010 19.36, Gadiyar, Anand ha scritto:

Quoted 19 lines
Quoted 17 lines · Andrea Paterniani

Hi,
I have applied your patches to kernel 2.6.35-rc4 running on my beagleboard.
I'm using kexec-tools-2.0.1.

My u-boot bootargs is:

      console=ttyS2,115200n8 root=/dev/mmcblk0p2 rw rootfstype=ext3 rootwait ip=192.168.2.13::255.255.255.0

To restart the system I type:

Quoted 3 lines

sync
kexec -l /boot/zImage --append="console=ttyS2,115200n8 root=/dev/mmcblk0p2 rw rootfstype=ext3 rootwait ip=192.168.2.13::255.255.255.0" kexec -e

Not every time the system restart.
In some cases no output on the console after the following:
Bye!
Uncompressing Linux... done, booting the kernel.

Quoted 7 lines
Quoted 3 lines

Any idea?

Can you try building your kernel with CONFIG_EARLY_PRINTK, and add the word "earlyprintk" to your bootargs?

How to enable EARLY_PRINTK for ARM architecture?
Browsing kernel source I find arch/arm/kernel/early_printk.c but no way to enable CONFIG_EARLY_PRINTK from make menuconfig.
Is there any patch to have this config option for ARM?

- Andrea

Quoted 25 lines
Quoted 24 lines

Il 05/07/2010 13.52, Thomas Gleixner ha scritto:

Quoted 20 lines

The following patch series addresses the problem that the kexec code does not disable the outer cache before disabling the inner cache and jumping into the new kernel. This results in random crashes of the new kernel.

Changes since version 2:

- Use CLEAN_INV_WAY in l2x0_flush_all according to Catalin

- Rename outer_cache_disable() to outer_disable()

- Added a BUG_ON() when l2x0_inv_all() is called with L2 enabled.

Thanks,

tglx

#9 lore raw

cover ARM: Disable outer cache before kexec call -V3

Quoted 36 lines

-----Original Message-----
From: Andrea Paterniani [mailto:a.paterniani at swapp-eng.it]
Sent: Wednesday, August 04, 2010 12:16 PM
To: Gadiyar, Anand
Cc: linux-arm-kernel at lists.infradead.org; Thomas Gleixner; catalin.marinas at arm.com; Shilimkar, Santosh
Subject: Re: [patch 0/2] ARM: Disable outer cache before kexec call -V3

Il 03/08/2010 19.36, Gadiyar, Anand ha scritto:

Quoted 4 lines
Quoted 2 lines · Andrea Paterniani

Hi,
I have applied your patches to kernel 2.6.35-rc4 running on my

beagleboard.

Quoted 4 lines
Quoted 4 lines

I'm using kexec-tools-2.0.1.

My u-boot bootargs is:

      console=ttyS2,115200n8 root=/dev/mmcblk0p2 rw rootfstype=ext3

rootwait ip=192.168.2.13::255.255.255.0

Quoted 4 lines
Quoted 4 lines

To restart the system I type:

Quoted 2 lines

sync
kexec -l /boot/zImage --append="console=ttyS2,115200n8

root=/dev/mmcblk0p2 rw rootfstype=ext3 rootwait
ip=192.168.2.13::255.255.255.0"

Quoted 10 lines
Quoted 10 lines
Quoted 1 line

kexec -e

Not every time the system restart.
In some cases no output on the console after the following:
Bye!
Uncompressing Linux... done, booting the kernel.

Any idea?

Quoted 9 lines
Quoted 4 lines

Can you try building your kernel with CONFIG_EARLY_PRINTK, and add the word "earlyprintk" to your bootargs?

How to enable EARLY_PRINTK for ARM architecture?
Browsing kernel source I find arch/arm/kernel/early_printk.c but no way to enable CONFIG_EARLY_PRINTK from make menuconfig.
Is there any patch to have this config option for ARM?

Menuconfig >

	 Kernel hacking -> 
		Kernel low-level debugging functions 
			-->Early printk (NEW)
#10 lore raw

cover ARM: Disable outer cache before kexec call -V3

In reply to Andrea Paterniani

Hi Andrea,

Quoted 21 lines · Andrea Paterniani

Il 03/08/2010 19.36, Gadiyar, Anand ha scritto:

Quoted 20 lines
Quoted 19 lines · Andrea Paterniani

Hi,
I have applied your patches to kernel 2.6.35-rc4 running on my beagleboard.
I'm using kexec-tools-2.0.1.

My u-boot bootargs is:

     console=ttyS2,115200n8 root=/dev/mmcblk0p2 rw rootfstype=ext3 rootwait ip=192.168.2.13::255.255.255.0

To restart the system I type:

Quoted 3 lines

sync
kexec -l /boot/zImage --append="console=ttyS2,115200n8 root=/dev/mmcblk0p2 rw rootfstype=ext3 rootwait ip=192.168.2.13::255.255.255.0" kexec -e

Not every time the system restart.
In some cases no output on the console after the following:
Bye!
Uncompressing Linux... done, booting the kernel.

Any idea?

Quoted 7 lines
Quoted 3 lines

Can you try building your kernel with CONFIG_EARLY_PRINTK, and add the word "earlyprintk" to your bootargs?

How to enable EARLY_PRINTK for ARM architecture? Browsing kernel source I find arch/arm/kernel/early_printk.c but no way to enable CONFIG_EARLY_PRINTK from make menuconfig. Is there any patch to have this config option for ARM?

EARLY_PRINTK is in arch/arm/Kconfig.debug. It depends on DEBUG_LL, though. So you must enable DEBUG_LL to make EARLY_PRINTK visible.

baruch

Quoted 20 lines

- Andrea

Quoted 18 lines
Quoted 18 lines

Il 05/07/2010 13.52, Thomas Gleixner ha scritto:

Quoted 16 lines

The following patch series addresses the problem that the kexec code does not disable the outer cache before disabling the inner cache and jumping into the new kernel. This results in random crashes of the new kernel.

Changes since version 2:

- Use CLEAN_INV_WAY in l2x0_flush_all according to Catalin

- Rename outer_cache_disable() to outer_disable()

- Added a BUG_ON() when l2x0_inv_all() is called with L2 enabled.

Thanks,

tglx

Signature · 3 lines
                                                     ~. .~   Tk Open Systems
=}------------------------------------------------ooO--U--Ooo------------{=
   - baruch at tkos.co.il - tel: +972.2.679.5364, http://www.tkos.co.il -
#11 lore raw

cover ARM: Disable outer cache before kexec call -V3

In reply to Gadiyar, Anand

Il 03/08/2010 19.36, Gadiyar, Anand ha scritto:

Quoted 19 lines
Quoted 17 lines · Andrea Paterniani

Hi,
I have applied your patches to kernel 2.6.35-rc4 running on my beagleboard.
I'm using kexec-tools-2.0.1.

My u-boot bootargs is:

      console=ttyS2,115200n8 root=/dev/mmcblk0p2 rw rootfstype=ext3 rootwait ip=192.168.2.13::255.255.255.0

To restart the system I type:

Quoted 3 lines

sync
kexec -l /boot/zImage --append="console=ttyS2,115200n8 root=/dev/mmcblk0p2 rw rootfstype=ext3 rootwait ip=192.168.2.13::255.255.255.0" kexec -e

Not every time the system restart.
In some cases no output on the console after the following:
Bye!
Uncompressing Linux... done, booting the kernel.

Quoted 7 lines
Quoted 3 lines

Any idea?

Can you try building your kernel with CONFIG_EARLY_PRINTK, and add the word "earlyprintk" to your bootargs?

I built the kernel with (also verified via zcat /proc/config.gz | grep ... after succesfull kexec):

CONFIG_EARLY_PRINTK=y
CONFIG_DEBUG_LL=y

I load new kernel zImage via:
kexec -l /boot/zImage --append="earlyprintk console=ttyS2,115200n8 root=/dev/mmcblk0p2 rw rootfstype=ext3 rootwait ip=192.168.2.13::255.255.255.0"

but when kexec fails I got only the following:
Bye!
Uncompressing Linux... done, booting the kernel.

What do I miss whith earlyprintk?

Perhaps I did not enough tests, but at the moment it seems that system boot with nfs rootfs followed by kexec with mmc rootfs works. Problems arise with system boot and kexec both with mmc rootfs.

Regards,
- Andrea

Quoted 30 lines
Quoted 24 lines

Il 05/07/2010 13.52, Thomas Gleixner ha scritto:

Quoted 20 lines

The following patch series addresses the problem that the kexec code does not disable the outer cache before disabling the inner cache and jumping into the new kernel. This results in random crashes of the new kernel.

Changes since version 2:

- Use CLEAN_INV_WAY in l2x0_flush_all according to Catalin

- Rename outer_cache_disable() to outer_disable()

- Added a BUG_ON() when l2x0_inv_all() is called with L2 enabled.

Thanks,

tglx

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel at lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

#12 lore raw

cover ARM: Disable outer cache before kexec call -V3

Any other suggestion?

Thanks
- Andrea

Il 04/08/2010 11.19, Andrea Paterniani ha scritto:

Quoted 79 lines

Il 03/08/2010 19.36, Gadiyar, Anand ha scritto:

Quoted 22 lines
Quoted 21 lines · Andrea Paterniani

Hi,
I have applied your patches to kernel 2.6.35-rc4 running on my
beagleboard.
I'm using kexec-tools-2.0.1.

My u-boot bootargs is:

      console=ttyS2,115200n8 root=/dev/mmcblk0p2 rw rootfstype=ext3 

rootwait ip=192.168.2.13::255.255.255.0

To restart the system I type:

Quoted 2 lines

sync
kexec -l /boot/zImage --append="console=ttyS2,115200n8

root=/dev/mmcblk0p2 rw rootfstype=ext3 rootwait
ip=192.168.2.13::255.255.255.0"

Quoted 1 line

kexec -e

Not every time the system restart.
In some cases no output on the console after the following:
Bye!
Uncompressing Linux... done, booting the kernel.

Quoted 5 lines
Quoted 2 lines

Any idea?

Can you try building your kernel with CONFIG_EARLY_PRINTK, and add the word "earlyprintk" to your bootargs?

I built the kernel with (also verified via zcat /proc/config.gz | grep ... after succesfull kexec):

CONFIG_EARLY_PRINTK=y
CONFIG_DEBUG_LL=y

I load new kernel zImage via:
kexec -l /boot/zImage --append="earlyprintk console=ttyS2,115200n8 root=/dev/mmcblk0p2 rw rootfstype=ext3 rootwait ip=192.168.2.13::255.255.255.0"

but when kexec fails I got only the following:
Bye!
Uncompressing Linux... done, booting the kernel.

What do I miss whith earlyprintk?

Perhaps I did not enough tests, but at the moment it seems that system boot with nfs rootfs followed by kexec with mmc rootfs works. Problems arise with system boot and kexec both with mmc rootfs.

Regards,
- Andrea

Quoted 26 lines
Quoted 21 lines

Il 05/07/2010 13.52, Thomas Gleixner ha scritto:

Quoted 19 lines

The following patch series addresses the problem that the kexec code does not disable the outer cache before disabling the inner cache and jumping into the new kernel. This results in random crashes of the new kernel.

Changes since version 2:

- Use CLEAN_INV_WAY in l2x0_flush_all according to Catalin

- Rename outer_cache_disable() to outer_disable()

- Added a BUG_ON() when l2x0_inv_all() is called with L2 enabled.

Thanks,

tglx

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel at lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel