linux kernel - Disabling all interrupts to protect CPU register state on multi processor systems -
i need ensure in code portion (in kernel mode) no 1 else can modify/check cr0 register. on one-processor system think disabling interrupts best. on multi-processor systems :
is there way disable interrupts processors during code section (with spinlock mechanism example)?
is necessary? when modifying
cr0
register on multi-processor system, guess register modified current cpu? --> disabling interrupts current cpu sufficient? --> there way check/modify other cpus (on same system) register cpu?
many in forward answers (and sorry approximative english)
jérôme.
jérôme,
have looked using spin_lock_irqsave()
, spin_unlock_irqrestore()
? disables local interrupts.
i believe more all-encompassing version spin_lock_irq()
, spin_unlock_irq()
stops interrupts unconditionally (like cli()/sti()
).
there many conditions take account when using these locking mechanisms. 1 of primary examples losing ability call kernel functions may sleep
while inside spin_lock
. may need bit of research before can determine best in particular case. brief explanation provided seems 1 of 2 schemes above should work you.
good luck!
Comments
Post a Comment