public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* BUG?: kernel does not (re)set irq smp_affinity to reboot_cpu
@ 2016-06-26 16:00 Hans de Goede
  2016-06-27  9:13 ` Marc Zyngier
  0 siblings, 1 reply; 10+ messages in thread
From: Hans de Goede @ 2016-06-26 16:00 UTC (permalink / raw)
  To: linux-arm-kernel, Linux Kernel Mailing List, Thomas Gleixner
  Cc: Maxime Ripard, Chen-Yu Tsai

Hi,

I've just spend most of my Sunday debugging a problem
where Allwinner ARM SoC based boards will not shutdown when
using a Fedora 24 userland, where as the exact same
kernel works fine with Fedora 22.

It turns out that irq-balanced is to blame. In Fedora 24
it pins the i2c controller, which talks to the pmic
which is needed for poweroff to cpu-id 1:

[root@localhost ~]# cat /proc/irq/49/smp_affinity
2

Where as the reboot_cpu is cpu-id 0 and with
cpu 1 disabled at poweroff time, the i2c transfer
never gets past its first step leading to an i2c
driver timeout + kernel panic due to machine_power_off()
returning.

As a workaround I can stop irq-balanced and do:

echo 3 > /proc/irq/49/smp_affinity

Before doing poweroff and then everything works as
expected again.

Now the question is how to fix this?

IMHO this is a kernel-bug, if we disable CPU-s then we
should unpin any irqs pinned to them before doing so.

If someone can write a fix for this I will be more then
happy to test it.

Although I'm mostly unfamiliar with the irq code I'm also
willing to try and write a fix myself, assuming that
people agree that this is the right thing to-do, and
that I can get some hints where to start.

Regards,

Hans



p.s.

I also noticed the following in the arm reboot code:

void machine_power_off(void)
{
         local_irq_disable();
         smp_send_stop();

         if (pm_power_off)
                 pm_power_off();
}

And I cannot help but wonder what re-enables local-irqs ?
Clearly something does as they are needed for the i2c
communication done by the m_power_off() call.

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2016-06-27 14:55 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-06-26 16:00 BUG?: kernel does not (re)set irq smp_affinity to reboot_cpu Hans de Goede
2016-06-27  9:13 ` Marc Zyngier
2016-06-27  9:45   ` Russell King - ARM Linux
2016-06-27 10:55     ` Hans de Goede
2016-06-27 11:31       ` Russell King - ARM Linux
2016-06-27 11:46         ` Russell King - ARM Linux
2016-06-27 12:53         ` Hans de Goede
2016-06-27 13:57           ` Russell King - ARM Linux
2016-06-27 14:37             ` Hans de Goede
2016-06-27 14:54           ` Mark Rutland

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox