Date: Tue, 26 Nov 2013 10:36:02 +0100 From: Wojciech Macek <wma@semihalf.com> To: arm@freebsd.org Cc: Olivier Houchard <cognet@freebsd.org> Subject: Re: arm SMP fix Message-ID: <CANsEV8e_6oNUA0sD3_5_zDabKxE84z15zFAUTgt70UGnnx6S8Q@mail.gmail.com> In-Reply-To: <CAFHCsPUfXhDW-UL1iXUe5ez5QbdFC=HCWmbisuf0fFASOF=LuQ@mail.gmail.com> References: <20131122000457.GA44039@freebsd.org> <CAFHCsPUfXhDW-UL1iXUe5ez5QbdFC=HCWmbisuf0fFASOF=LuQ@mail.gmail.com>
next in thread | previous in thread | raw e-mail | index | archive | help
--089e013a1bae77ebd904ec113580 Content-Type: text/plain; charset=ISO-8859-1 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@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@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" > > > _______________________________________________ > 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" > --089e013a1bae77ebd904ec113580 Content-Type: text/x-patch; charset=US-ASCII; name="pcpu_cpu_mask.patch" Content-Disposition: attachment; filename="pcpu_cpu_mask.patch" Content-Transfer-Encoding: base64 X-Attachment-Id: f_hogxvv6h0 ZGlmZiAtLWdpdCBhL3N5cy9hcm0vaW5jbHVkZS9wY3B1LmggYi9zeXMvYXJtL2luY2x1ZGUvcGNw dS5oCmluZGV4IGQ3MTNkM2QuLjdhNDU5N2QgMTAwNjQ0Ci0tLSBhL3N5cy9hcm0vaW5jbHVkZS9w Y3B1LmgKKysrIGIvc3lzL2FybS9pbmNsdWRlL3BjcHUuaApAQCAtNjMsNyArNjMsNyBAQCBleHRl cm4gc3RydWN0IHBjcHUgKnBjcHVwOwogI2lmIEFSTV9BUkNIXzYgfHwgQVJNX0FSQ0hfN0EKIC8q IG9yIEFSTV9UUF9BRERSRVNTIAltYXJrIFJFTU9WRSBNRSBOT1RFICovCiAKLSNkZWZpbmUgQ1BV X01BU0sgKDB4MTUpCisjZGVmaW5lIENQVV9NQVNLICgweDMpCiAKICNkZWZpbmUgZ2V0X3BjcHUo KSBfX2V4dGVuc2lvbl9fICh7CQkJICAJCVwKIAlpbnQgaWQ7CQkJCQkJCQlcCg== --089e013a1bae77ebd904ec113580--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CANsEV8e_6oNUA0sD3_5_zDabKxE84z15zFAUTgt70UGnnx6S8Q>