weird behavior of get/set_fiq_regs()

Russell King - ARM Linux linux at arm.linux.org.uk
Mon Jul 6 09:02:30 PDT 2015


On Mon, Jul 06, 2015 at 04:48:38PM +0200, Holger Schurig wrote:
> Hi,
> 
> I'm trying to write a FIQ ISR handler. I wanted to use some registers
> to transfer information to/from the the FIQ ISR. But something changes
> the registers:

We should probably make the FIQ code depend on !SMP, or at least complain
if num_online_cpus > 1 and if we're in a schedulable context,  because the
issue you're running into is precisely that.

FIQ registers are not global amongst CPUs.  They're local to the CPU you
execute the code on.  What this means is that when you call set_fiq_regs(),
you are setting the FIQ registers on the CPU which executes set_fiq_regs().
Same goes for get_fiq_regs().

If they happen to be different CPUs, then you'll read a different set of
registers.

So, what you need to do is to ensure that the code which is using FIQs
all runs on the same CPU.

Also note that you'll get into hot water if you try to have FIQ handlers
in module code.

-- 
FTTC broadband for 0.8mile line: currently at 10.5Mbps down 400kbps up
according to speedtest.net.



More information about the linux-arm-kernel mailing list