svn commit: r313037 - in head/sys: amd64/include kern mips/include net powerpc/include sparc64/include

Alexander Kabaev kabaev at gmail.com
Sat Feb 4 19:56:44 UTC 2017


On Fri, 3 Feb 2017 21:29:33 -0800
Jason Harmening <jason.harmening at gmail.com> wrote:

> Hi,
> 
> I'm a bit confused as to how this change breaks MIPS.  The new
> function, get_pcpu() is intended to be used only to access the
> per-cpu data pointer locally.  It returns pcpup, which is the per-cpu
> pointer wired into the local TLB to translate to the local CPU's
> physical data region, correct?
> 
> This is the same value used by the per-CPU accessors such as PCPU_ADD
> and PCPU_GET.  The MI portions of this change only use get_pcpu() to
> access the local CPU's data, e.g. under a critical section in the
> rmlock.  It is not intended to be used for iterating all CPUs.
> 
> If I've missed something and MIPS is truly broken by this, then I'll
> gladly revert, but (maybe because it's late) I'm not seeing where
> this goes wrong on MIPS.
> 
> Thanks,
> Jason

The hang is actually due to _rmlock_assert spinning in
rm_trackers_present with interrupts disabled, due to this constructs:

        for (queue = pc->pc_rm_queue.rmq_next; queue !=
            &pc->pc_rm_queue; queue = queue->rmq_next) {

You changed the code to pass get_pcpu() results instead of direct
pointer to the corresponding pcpu storage and that is NOT the pointer
that was being used in pcpu_init. On architectures that rig TLB to make
local PCPU available at constant address from each CPU, these two are
generally not same, so while empty pc_rm_queue is a cyclic list
consisting of just one element pc_rm_queue, the loop terminating
condition will never be met, as &pc->pc_rm_qeue value will be very
different from the one that pc->pc_rm_queue.rmq_next was set at
initialisation time.

This affects MIPS in SMP configuration only, UP configs do not bother
with TLB hackery.

-- 
Alexander Kabaev
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 963 bytes
Desc: Цифровая подпись OpenPGP
URL: <http://lists.freebsd.org/pipermail/svn-src-all/attachments/20170204/150351f6/attachment.sig>


More information about the svn-src-all mailing list