arm SMP fix

Svatopluk Kraus onwahe at gmail.com
Mon Nov 25 12:49:04 UTC 2013


Hi,

we use another approach to the problem at work for now. So, I have only one
comment. Can be explicitly stated in commit that PCPU_GET() is not needed
to be atomic? Otherwise, it will look that problem with curthread is solved
but similar problem with PCPU_GET() starts up.

In fact, atomicity of PCPU_GET() must be ensured in code where is used.

Svatopluk Kraus


On Fri, Nov 22, 2013 at 1:04 AM, Olivier Houchard <cognet at freebsd.org>wrote:

> 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
>
> _______________________________________________
> freebsd-arm at freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-arm
> To unsubscribe, send any mail to "freebsd-arm-unsubscribe at freebsd.org"
>


More information about the freebsd-arm mailing list