local_irq_enable in restart handler

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

 



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.


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

[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]

  Powered by Linux