From owner-freebsd-hackers@FreeBSD.ORG Tue Jun 9 07:24:04 2015 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id D338A13B for ; Tue, 9 Jun 2015 07:24:04 +0000 (UTC) (envelope-from sebastian.huber@embedded-brains.de) Received: from mail.embedded-brains.de (host-82-135-62-35.customer.m-online.net [82.135.62.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 7D3C814BB for ; Tue, 9 Jun 2015 07:24:03 +0000 (UTC) (envelope-from sebastian.huber@embedded-brains.de) Received: from localhost (localhost.localhost [127.0.0.1]) by mail.embedded-brains.de (Postfix) with ESMTP id AB2232A1939 for ; Tue, 9 Jun 2015 09:24:04 +0200 (CEST) Received: from mail.embedded-brains.de ([127.0.0.1]) by localhost (zimbra.eb.localhost [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id imGqDD26O_tp for ; Tue, 9 Jun 2015 09:24:02 +0200 (CEST) Received: from localhost (localhost.localhost [127.0.0.1]) by mail.embedded-brains.de (Postfix) with ESMTP id 4DCBD2A1994 for ; Tue, 9 Jun 2015 09:24:02 +0200 (CEST) X-Virus-Scanned: amavisd-new at zimbra.eb.localhost Received: from mail.embedded-brains.de ([127.0.0.1]) by localhost (zimbra.eb.localhost [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id 9JFFfCpn0gFu for ; Tue, 9 Jun 2015 09:24:02 +0200 (CEST) Received: from [192.168.96.129] (unknown [192.168.96.129]) by mail.embedded-brains.de (Postfix) with ESMTPSA id 1E1EE2A1989 for ; Tue, 9 Jun 2015 09:24:02 +0200 (CEST) Message-ID: <55769487.20901@embedded-brains.de> Date: Tue, 09 Jun 2015 09:23:51 +0200 From: Sebastian Huber User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.7.0 MIME-Version: 1.0 To: freebsd-hackers@freebsd.org Subject: Re: [PATCH] timecounters: Fix timehand generation read/write References: <1433331966-27548-1-git-send-email-sebastian.huber@embedded-brains.de> <20150603203228.GA9774@britannica.bec.de> <2023236942.13088.1433365253885.JavaMail.zimbra@embedded-brains.de> <20150604181041.GC11630@britannica.bec.de> In-Reply-To: <20150604181041.GC11630@britannica.bec.de> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: quoted-printable X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 09 Jun 2015 07:24:05 -0000 On 04/06/15 20:10, Joerg Sonnenberger wrote: > On Wed, Jun 03, 2015 at 11:00:53PM +0200, Sebastian Huber wrote: >> In my interpretation of the C standard this is implementation defined = behaviour. See also: >> >> https://gcc.gnu.org/onlinedocs/gcc/Volatiles.html > I don't think that is nearly correct as far as any data accessibly from > global objects is concerned beside the volatile. C11 5.1.2.3 (2) and (3= ) > are the relevant clauses. An assignment to a volatile object is a > sequence point with side effects. All assignments before that sequence > point must be visible to whatever possible side effect the volatile has= . > Similar, it can implicitly change all globals, so no read can be moved > from after the sequence point to before. This is much stricter than the > normal as-if rule, since a sequence of side-effect-free operations can > be implemented anyway the compiler likes. A different interpretation > would be quite questionable. > > Note that this is all just about the rules of the C abstract machine. I= t > is not about the observable behavior of a multi-processor machine. > Whether or not TSO is enough for this purpose is a completely different > question. I didn't want to start a discussion about the C standard interpretation.=20 GCC generates code according to their documentation: https://lists.freebsd.org/pipermail/freebsd-hackers/2015-May/047778.html In case you think GCC is doing something wrong, then maybe you can file=20 a bug report for GCC. Anyway we need real memory barriers. --=20 Sebastian Huber, embedded brains GmbH Address : Dornierstr. 4, D-82178 Puchheim, Germany Phone : +49 89 189 47 41-16 Fax : +49 89 189 47 41-09 E-Mail : sebastian.huber@embedded-brains.de PGP : Public key available on request. Diese Nachricht ist keine gesch=E4ftliche Mitteilung im Sinne des EHUG.