Received: from eggs.gnu.org ([2001:4830:134:3::10]:39006) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bNEiK-0007DK-5q for qemu-devel@nongnu.org; Wed, 13 Jul 2016 03:36:13 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bNEiG-0003V4-17 for qemu-devel@nongnu.org; Wed, 13 Jul 2016 03:36:11 -0400 Received: from mail-lf0-x230.google.com ([2a00:1450:4010:c07::230]:33975) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bNEiF-0003Ux-P6 for qemu-devel@nongnu.org; Wed, 13 Jul 2016 03:36:07 -0400 Received: by mail-lf0-x230.google.com with SMTP id h129so31743701lfh.1 for ; Wed, 13 Jul 2016 00:36:07 -0700 (PDT) Sender: Paolo Bonzini References: <1468354426-837-1-git-send-email-sergey.fedorov@linaro.org> <1468354426-837-2-git-send-email-sergey.fedorov@linaro.org> <20160712231917.GA11378@flamenco> From: Paolo Bonzini Message-ID: Date: Wed, 13 Jul 2016 09:36:01 +0200 MIME-Version: 1.0 In-Reply-To: <20160712231917.GA11378@flamenco> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH v3 01/11] util/qht: Document memory ordering assumptions List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: "Emilio G. Cota" , Sergey Fedorov Cc: mttcg@listserver.greensocs.com, peter.maydell@linaro.org, claudio.fontana@huawei.com, patches@linaro.org, jan.kiszka@siemens.com, mark.burton@greensocs.com, a.rigo@virtualopensystems.com, qemu-devel@nongnu.org, serge.fdrv@gmail.com, bobby.prani@gmail.com, rth@twiddle.net, =?UTF-8?Q?Alex_Benn=c3=a9e?= , fred.konrad@greensocs.com On 13/07/2016 01:19, Emilio G. Cota wrote: > I wouldn't put those comments in the source--seqlock callers should > know what they're doing, and what barriers seqlocks imply. In general I'd agree with you, however in this case the "begin" calls are what implements QHT's guarantee *for the caller*, so I think it's worth having the comments. In other words, if for any reason you do anything before the read_begin and write_begin you still have to provide barrier semantics. It's not an explanation, it's a protection against future mistakes. There's no need for such comment at read_retry and write_end callsites, though. Also, it's spelled "guarantee". :) Paolo > I'm OK with stating what the implied ordering is in the header > file, though.