From owner-freebsd-ppc@FreeBSD.ORG Thu May 31 23:08:04 2012 Return-Path: Delivered-To: powerpc@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 27004106564A; Thu, 31 May 2012 23:08:04 +0000 (UTC) (envelope-from zbb@semihalf.com) Received: from smtp.semihalf.com (smtp.semihalf.com [213.17.239.109]) by mx1.freebsd.org (Postfix) with ESMTP id 98E5B8FC14; Thu, 31 May 2012 23:08:03 +0000 (UTC) Received: from localhost (unknown [213.17.239.109]) by smtp.semihalf.com (Postfix) with ESMTP id 29E47C3845; Fri, 1 Jun 2012 01:07:47 +0200 (CEST) X-Virus-Scanned: by amavisd-new at semihalf.com Received: from smtp.semihalf.com ([213.17.239.109]) by localhost (smtp.semihalf.com [213.17.239.109]) (amavisd-new, port 10024) with ESMTP id iWZMAAHkHzuQ; Fri, 1 Jun 2012 01:07:36 +0200 (CEST) Received: from webmail.semihalf.com (semihalf.com [206.130.101.55]) by smtp.semihalf.com (Postfix) with ESMTPSA id AD513C384F; Fri, 1 Jun 2012 01:07:34 +0200 (CEST) MIME-Version: 1.0 Date: Thu, 31 May 2012 17:07:42 -0600 From: Zbigniew Bodek To: Marcel Moolenaar In-Reply-To: <251AF144-587C-4854-88B2-0CD7D26E1DF1@xcllnt.net> References: <0362C399-CB54-451E-A879-E836EF13CE72@semihalf.com> <251AF144-587C-4854-88B2-0CD7D26E1DF1@xcllnt.net> Message-ID: X-Sender: zbb@semihalf.com User-Agent: RoundCube Webmail/0.2.2 Content-Type: multipart/mixed; boundary="=_3b7ad5037c6a1e9c6e236a745119b2c2" Cc: powerpc@freebsd.org, =?UTF-8?Q?Piotr_Zi=C4=99cik?= Subject: Re: RFC: OpenPIC IPI patch X-BeenThere: freebsd-ppc@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Porting FreeBSD to the PowerPC List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 31 May 2012 23:08:04 -0000 --=_3b7ad5037c6a1e9c6e236a745119b2c2 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="UTF-8" On Wed, 30 May 2012 13:36:46 -0700, Marcel Moolenaar wrote: > On May 30, 2012, at 1:13 PM, Rafal Jaworowski wrote: > >> Can you please have a look at this patch and let us know about any >> comments / objections? We identified a problem with IPI on the recent FSL >> eOpenPIC, description in the patch: >> >> http://people.freebsd.org/~raj/patches/powerpc/openpic.diff > > Looks good. Please consider adding some checks to openpic_ipi() where > we peek into the cpuset_t type and access the "bits". An assert would > be nice if the set contains cpus number 32 or up. This to make it > painfully obvious that it's time to extend openpic_ipi() to handle more > than 32 CPUs if and when the need arises. > > FYI, Indeed, there should be a sanity check in here. I suggest the following assert: diff --git a/sys/powerpc/powerpc/openpic.c b/sys/powerpc/powerpc/openpic.c index 95af605..45858b6 100644 --- a/sys/powerpc/powerpc/openpic.c +++ b/sys/powerpc/powerpc/openpic.c @@ -29,6 +29,7 @@ #include #include #include +#include #include #include #include @@ -344,8 +345,14 @@ void openpic_ipi(device_t dev, cpuset_t cpumask) { struct openpic_softc *sc; + cpuset_t ns_cpus; /* Mask of not supported CPUs */ + + CPU_FILL(&ns_cpus); + ns_cpus.__bits[0] = 0; KASSERT(dev == root_pic, ("Cannot send IPIs from non-root OpenPIC")); + KASSERT(CPU_OVERLAP(&ns_cpus, &cpumask) == 0, + ("Cannot send an IPI to a CPU which number exceeds #31")); sc = device_get_softc(dev); sched_pin(); The patch is also available in the email's attachment. Please send any comments and/or objections. Best regards Zbyszek Bodek --=_3b7ad5037c6a1e9c6e236a745119b2c2 Content-Transfer-Encoding: base64 Content-Type: text/x-patch; charset="UTF-8"; name="ipi_assert.patch"; Content-Disposition: attachment; filename="ipi_assert.patch"; ZGlmZiAtLWdpdCBhL3N5cy9wb3dlcnBjL3Bvd2VycGMvb3BlbnBpYy5jIGIvc3lzL3Bvd2VycGMv cG93ZXJwYy9vcGVucGljL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