arm SMP fix

Olivier Houchard cognet at FreeBSD.ORG
Fri Nov 22 00:04:57 UTC 2013


Hi all,                                                                         

Attached is the first draft to a patch that fixes SMP for me, it seems to       
work fine on my Pandaboard.                                                     
The problem is, as it is currently implemented, curthread is basically          
defined as get_pcpu()->pc_curthread. If we get interrupted between the moment   
we got the struct pcpu, and the moment we derefence it to get the curthread 
pointer, and migrated to another core, we would get the wrong curthread, and    
that's not good.                                                                
The proposed fix does the following :                                           
- use the register we used to use for pcpu for curthread                        
- get the pcpu address by reading the cpu id from the CPUID register, and       
just use it as an index for the __pcpu array.                                   
                                                                                
It breaks the KBI, which is unfortunate, but I think it is no big deal for      
arm right now.                                                                  
                                                                                
Any review, comment, and testing, even on UP boards, would be very welcome.     
                                                                                
Regards,                                                                        

Olivier 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: arm_smp_fix.diff
Type: text/x-diff
Size: 9572 bytes
Desc: not available
URL: <http://lists.freebsd.org/pipermail/freebsd-arm/attachments/20131122/a9f4b04c/attachment.diff>


More information about the freebsd-arm mailing list