Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 25 Nov 2013 13:49:02 +0100
From:      Svatopluk Kraus <onwahe@gmail.com>
To:        Olivier Houchard <cognet@freebsd.org>
Cc:        arm@freebsd.org
Subject:   Re: arm SMP fix
Message-ID:  <CAFHCsPUfXhDW-UL1iXUe5ez5QbdFC=HCWmbisuf0fFASOF=LuQ@mail.gmail.com>
In-Reply-To: <20131122000457.GA44039@freebsd.org>
References:  <20131122000457.GA44039@freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
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@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@freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-arm
> To unsubscribe, send any mail to "freebsd-arm-unsubscribe@freebsd.org"
>



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAFHCsPUfXhDW-UL1iXUe5ez5QbdFC=HCWmbisuf0fFASOF=LuQ>