NetBSD Problem Report #41370
From bouyer@antioche.eu.org Wed May 6 18:40:08 2009
Return-Path: <bouyer@antioche.eu.org>
Received: from mail.netbsd.org (mail.netbsd.org [204.152.190.11])
by www.NetBSD.org (Postfix) with ESMTP id 99F4E63B8DF
for <gnats-bugs@gnats.NetBSD.org>; Wed, 6 May 2009 18:40:08 +0000 (UTC)
Message-Id: <200905061840.n46Ie5Oc004168@rochebonne.antioche.eu.org>
Date: Wed, 6 May 2009 20:40:05 +0200 (CEST)
From: Manuel Bouyer <bouyer@antioche.eu.org>
Reply-To: bouyer@antioche.eu.org
To: gnats-bugs@gnats.NetBSD.org
Subject: inline splx() and splraise() needs __insn_barrier()
X-Send-Pr-Version: 3.95
>Number: 41370
>Category: port-powerpc
>Synopsis: inline splx() and splraise() needs __insn_barrier()
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: port-powerpc-maintainer
>State: closed
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Wed May 06 18:45:00 +0000 2009
>Closed-Date: Tue Nov 27 21:30:13 +0000 2018
>Last-Modified: Tue Nov 27 21:30:13 +0000 2018
>Originator: Manuel Bouyer
>Release: NetBSD 5.0
>Organization:
>Environment:
5.0_STABLE sources
Architecture: powerpc
Machine: powerpc
>Description:
if splhigh() is an inline or macro, the compiler may optimise things
wrongly around it. An example is softint_schedule(), where the
second check for SOFTINT_PENDING is optimised out. See PR kern/38637
for details.
To avoid this, splraise(), spllower() and splx() should be a
barrier for the compiler; in the case of inline powerpc version of
these functions a __insn_barrier() may be needed.
>How-To-Repeat:
code inspection
>Fix:
Index: marvell/marvell_intr.h
===================================================================
RCS file: /cvsroot/src/sys/arch/powerpc/marvell/marvell_intr.h,v
retrieving revision 1.15
diff -u -p -u -r1.15 marvell_intr.h
--- marvell/marvell_intr.h 28 Apr 2008 20:23:32 -0000 1.15
+++ marvell/marvell_intr.h 6 May 2009 18:39:36 -0000
@@ -360,6 +360,7 @@ splraise(int ncpl)
}
}
extintr_restore(omsr);
+ __insn_barrier();
return (ocpl);
}
@@ -370,6 +371,7 @@ splx(int xcpl)
register_t omsr;
int ncpl = xcpl & IPL_PRIMASK;
+ __insn_barrier();
ncplp = &imask[ncpl];
omsr = extintr_disable();
@@ -391,6 +393,7 @@ spllower(int ncpl)
imask_t *ncplp;
register_t omsr;
+ __insn_barrier();
ncpl &= IPL_PRIMASK;
ncplp = &imask[ncpl];
>Release-Note:
>Audit-Trail:
From: "David H. Gutteridge" <dhgutteridge@sympatico.ca>
To: gnats-bugs@netbsd.org
Cc:
Subject: Re: port-powerpc/41370 (inline splx() and splraise() needs
__insn_barrier())
Date: Wed, 01 Feb 2017 15:33:07 -0500
The applicable code was later refactored into a shared source file,
which I believe is now sys/arch/powerpc/pic/intr.c, in which I can see
the functions in question have __insn_barrier() calls, so I think this
can be closed?
Dave
State-Changed-From-To: open->feedback
State-Changed-By: maya@NetBSD.org
State-Changed-When: Tue, 27 Nov 2018 21:10:54 +0000
State-Changed-Why:
Do you think the new state is satisfactory?
From: Manuel Bouyer <bouyer@antioche.eu.org>
To: gnats-bugs@NetBSD.org
Cc: port-powerpc-maintainer@netbsd.org, netbsd-bugs@netbsd.org,
gnats-admin@netbsd.org, maya@NetBSD.org
Subject: Re: port-powerpc/41370 (inline splx() and splraise() needs
__insn_barrier())
Date: Tue, 27 Nov 2018 22:22:34 +0100
On Tue, Nov 27, 2018 at 09:10:54PM +0000, maya@NetBSD.org wrote:
> Synopsis: inline splx() and splraise() needs __insn_barrier()
>
> State-Changed-From-To: open->feedback
> State-Changed-By: maya@NetBSD.org
> State-Changed-When: Tue, 27 Nov 2018 21:10:54 +0000
> State-Changed-Why:
> Do you think the new state is satisfactory?
Yes, AFAIK the code in pic/intr.c look correct.
--
Manuel Bouyer <bouyer@antioche.eu.org>
NetBSD: 26 ans d'experience feront toujours la difference
--
State-Changed-From-To: feedback->closed
State-Changed-By: maya@NetBSD.org
State-Changed-When: Tue, 27 Nov 2018 21:30:13 +0000
State-Changed-Why:
feedback ok. thanks for the quick response.
>Unformatted:
(Contact us)
$NetBSD: query-full-pr,v 1.43 2018/01/16 07:36:43 maya Exp $
$NetBSD: gnats_config.sh,v 1.9 2014/08/02 14:16:04 spz Exp $
Copyright © 1994-2017
The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.