From owner-freebsd-hackers@freebsd.org Sun Jul 3 00:09:07 2016 Return-Path: Delivered-To: freebsd-hackers@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id DEA76B81222 for ; Sun, 3 Jul 2016 00:09:07 +0000 (UTC) (envelope-from nwhitehorn@freebsd.org) Received: from d.mail.sonic.net (d.mail.sonic.net [64.142.111.50]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id CC37D20C3 for ; Sun, 3 Jul 2016 00:09:07 +0000 (UTC) (envelope-from nwhitehorn@freebsd.org) Received: from zeppelin.tachypleus.net ([75.104.66.200]) (authenticated bits=0) by d.mail.sonic.net (8.15.1/8.15.1) with ESMTPSA id u6308oKv001358 (version=TLSv1.2 cipher=DHE-RSA-AES128-SHA bits=128 verify=NOT); Sat, 2 Jul 2016 17:08:56 -0700 Subject: Re: Review request: sparse CPU ID maps To: outro pessoa References: <57761101.3030101@freebsd.org> Cc: "freebsd-hackers@freebsd.org" From: Nathan Whitehorn Message-ID: <5345fb94-91b8-5019-037e-d4825a694cfd@freebsd.org> Date: Sat, 2 Jul 2016 17:08:54 -0700 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:45.0) Gecko/20100101 Thunderbird/45.1.0 MIME-Version: 1.0 In-Reply-To: X-Sonic-CAuth: UmFuZG9tSVYKmi8BVaO5vdwkFcy3d3W2aVNoXDMOt/jA28xtNafKqHjwt8UBhPWQ+fp0+rdq8bMkuG8QZshgnKtV8sUFzvflfsO0Q/6f0hY= X-Sonic-ID: C;TiMlUrJA5hGo5pNwxPCmMQ== M;dKzDVLJA5hGo5pNwxPCmMQ== X-Spam-Flag: No X-Sonic-Spam-Details: 0.0/5.0 by cerberusd Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-Content-Filtered-By: Mailman/MimeDel 2.1.22 X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 03 Jul 2016 00:09:08 -0000 A reasonable first pass at checking for this kind of bug is doing grep -lR '< mp_ncpus'. Running that on sys/arm and sys/arm64 shows the following files: arm/mv/armadaxp/armadaxp_mp.c arm/include/counter.h arm/broadcom/bcm2835/bcm2836.c arm/broadcom/bcm2835/bcm2836_mp.c arm/freescale/imx/imx6_mp.c arm/allwinner/aw_mp.c arm/rockchip/rk30xx_mp.c arm/amlogic/aml8726/aml8726_mp.c arm/samsung/exynos/exynos5_mp.c arm/arm/mp_machdep.c arm/nvidia/tegra124/tegra124_mp.c arm64/include/counter.h arm64/arm64/gic_v3.c arm64/arm64/gic_v3_its.c arm64/arm64/gicv3_its.c All of them should, in some sense, be CPU_FOREACH(), but it may not matter. For example, it may not be possible to have sparse CPU IDs on some or all of those SOCs. At least the generic ones (counter, mp_machdep.c, gic (why are there both gic_v3_its.c and gicv3_its.c?)) should be changed, I think. -Nathan On 07/02/16 10:31, outro pessoa wrote: > Nathan, > What type of ARM hardware do you need? > > On Fri, Jul 1, 2016 at 2:43 AM, Nathan Whitehorn > > wrote: > > I have been working on fixing PR 210106 > (https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=210106) and > have run into the fact that several pieces of the kernel, notably > parts of subr_taskqueue.c, require that CPU IDs be dense in the > range [0, mp_ncpus), which the kernel does not guarantee, for > example in the case of CPUs with hyperthreading in which the > threading is disabled. This is leading to hangs in late boot in > -CURRENT. > > I've prepared the following patch, which fixes PR 210106, but I > would like a few more eyeballs on it before committing it. It > fixes most of the bogus uses of mp_ncpus in the kernel, but not > all: doing grep -R '< mp_ncpus' /sys | wc -l gives 52 remaining > instances of loops in [0, mp_ncpus) or [1, mp_ncpus), most or all > of which should instead be CPU_FOREACH(), but none of which I feel > comfortable changing (36 are in ARM code for hardware I don't have > access to). > > The patch lives here: > http://people.freebsd.org/~nwhitehorn/sparse_cpu_ids.diff > > -Nathan > _______________________________________________ > freebsd-hackers@freebsd.org > mailing list > https://lists.freebsd.org/mailman/listinfo/freebsd-hackers > To unsubscribe, send any mail to > "freebsd-hackers-unsubscribe@freebsd.org > " > >