arm SMP fix

Wojciech Macek wma at semihalf.com
Tue Nov 26 09:36:09 UTC 2013


Hi,

Applying the patch is causing a failure on systems with more than 2 cores.
get_pcpu() macro is masking cpuid with incorrect value, since the only last
two bits of cp15 register contain the right value. Simple fix attached
below.

Regards,
Wojtek


2013/11/25 Svatopluk Kraus <onwahe at gmail.com>

> 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"
> >
> _______________________________________________
> 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"
>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pcpu_cpu_mask.patch
Type: text/x-patch
Size: 388 bytes
Desc: not available
URL: <http://lists.freebsd.org/pipermail/freebsd-arm/attachments/20131126/3cddec1e/attachment.bin>


More information about the freebsd-arm mailing list