[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: linux 3.10.1 with initrd (was Re: linux 3.8.12-1 (atari flavour) does not boot)



On Fri, Aug 2, 2013 at 11:08 AM, Michael Schmitz
<schmitz@biophys.uni-duesseldorf.de> wrote:
>>> [    0.160000] WARNING: at /root/linux-3.10.1/init/main.c:698
>>> do_one_initcall+0x12e/0x13a()
>>> [    0.160000] initcall param_sysfs_init+0x0/0x1a4 returned with disabled
>>> interrupts
>>>
>>> This seems to happen for several initcalls. Geert et al,
>>> can you have a look at them, they’re scary ☺
>>
>>
>> It only happens on multi-platform kernels, because of the following
>> definition
>> of ALLOWINT:
>>
>> #if defined(MACH_ATARI_ONLY)
>>         /* block out HSYNC = ipl 2 on the atari */
>> #define ALLOWINT        (~0x500)
>> #else
>>         /* portable version */
>> #define ALLOWINT        (~0x700)
>> #endif /* machine compilation types */
>>
>> On an Atari-only kernel, flags is either 0x00c02204 or 0x00c02214.
>> Hence "flags & ~ALLOWINT" is "flags & 0x500" is always zero.
>>
>> On a multi-platform kernel, flags is one of 0x00c02004, 0x00c02014,
>> 0x00c02204, or 0x00c02214.
>> Hence "flags & ~ALLOWINT" is "flags & 0x700" is sometimes non-zero,
>> triggering the warning.
>>
>> Anyone who sees a solution that doesn't involve adding a variable to hold
>> ALLOWINT?
>>
>> We're already having a check for Q40 in arch_local_irq_enable()
>> (in multi-platfom kernels only).
>
>
> Didn't we have that sorted out earlier? I seem to recall this has surfaced
> before.

You mean commit 94674cd5299e825cb31979c3b9a4c1a3e6074839
("m68k: Correct the Atari ALLOWINT definition")? That was a related but
slightly different problem.

> What is the cause of the problem exactly - the hsync handler changing the
> IPL to block out further interrupts, whenever it is called for the first
> time after interrupts are enabled? We could stop doing that on
> multi-platform kernels (taking all hsync interrupts will be a performance
> hit but not stop the system from working).

AFAICS, it's indeed the hsync handler blocking further interrupts on
multi-platform kernels.

On multi-platform kernels, enabling interrupts enables all 7 levels
(interrupt enable/disable is either all-or-nothing in Linux, there are
no priorities).
When the hblank interrupt comes in, its handler (falcon_hblhandler())
disables level 2 interrupts again, to prevent more interrupts coming in,
which would slow down the system.
However, this causes arch_irqs_disabled_flags() to think interrupts are
completely disabled, causing the warnings in the logs.

We could ignore IPL2 when running on Atari (untested whitespace-damaged
patch):

--- a/arch/m68k/include/asm/irqflags.h
+++ b/arch/m68k/include/asm/irqflags.h
@@ -67,7 +67,11 @@ static inline void arch_local_irq_restore(unsigned long flags

 static inline bool arch_irqs_disabled_flags(unsigned long flags)
 {
-       return (flags & ~ALLOWINT) != 0;
+       if (MACH_IS_ATARI) {
+               /* Ignore HSYNC = ipl 2 on Atari */
+               return (flags & ~(ALLOWINT | 0x200)) != 0;
+       } else
+           return (flags & ~ALLOWINT) != 0;
 }

 static inline bool arch_irqs_disabled(void)

or just ignore all priorities on all platforms, and consider interrupts disabled
iff all priorities are disabled:

--- a/arch/m68k/include/asm/irqflags.h
+++ b/arch/m68k/include/asm/irqflags.h
@@ -67,7 +67,7 @@ static inline void arch_local_irq_restore(unsigned long flags

 static inline bool arch_irqs_disabled_flags(unsigned long flags)
 {
-       return (flags & ~ALLOWINT) != 0;
+       return (flags & ~ALLOWINT) != ~ALLOWINT;
 }

 static inline bool arch_irqs_disabled(void)

The former is safer but slower, the second is faster but will miss cases
where some interrupt priorities are disabled.

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds


Reply to: