All of lore.kernel.org
 help / color / mirror / Atom feed
* local_irq_enable in restart handler
@ 2020-04-22 14:35 Tomek The Messenger
  0 siblings, 0 replies; only message in thread
From: Tomek The Messenger @ 2020-04-22 14:35 UTC (permalink / raw)
  To: kernelnewbies


[-- Attachment #1.1: Type: text/plain, Size: 1330 bytes --]

Hi
The background:
Interrupts are disabled just before stopping other cores during handling
restart:
See example from:
/arch/arm/kernel/reboot.c:
/*
 * Restart requires that the secondary CPUs stop performing any activity
 * while the primary CPU resets the system.
 */
void machine_restart(char *cmd)
{
local_irq_disable();
smp_send_stop();

do_kernel_restart(cmd);

/* Give a grace period for failure to restart of 1s */
mdelay(1000);

/* Whoops - the platform was unable to reboot. Tell the user! */
printk("Reboot failed -- System halted\n");
while (1);
}

where function do_kernel_restart() invoke restart handlers:
void do_kernel_restart(char *cmd)
{
     atomic_notifier_call_chain(&restart_handler_list, reboot_mode, cmd);
}

One and the only one! restart handler is mine where I do i2c transaction in
order to reset the board. i2c transaction requires interrupts to be enabled.
Can I safely do: local_irq_enable on my handler entry and local_irq_disable
just before exit? In the meantime I will do i2c_smbus transaction and add
some 500ms delay before disable back irq just to make sure transaction is
succeed.
I know that it is strange question, but in company in which I work I
received subtask to get to know. The other alternative is to get response
by execute test with for example loop of 10 thousands of restarts.

[-- Attachment #1.2: Type: text/html, Size: 1609 bytes --]

[-- Attachment #2: Type: text/plain, Size: 170 bytes --]

_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2020-04-22 14:36 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-22 14:35 local_irq_enable in restart handler Tomek The Messenger

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.