Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752856AbbGQBvv (ORCPT ); Thu, 16 Jul 2015 21:51:51 -0400 Received: from mga11.intel.com ([192.55.52.93]:65152 "EHLO mga11.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752227AbbGQBvt (ORCPT ); Thu, 16 Jul 2015 21:51:49 -0400 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.15,492,1432623600"; d="scan'208";a="607800581" Message-ID: <1437097907.12633.74.camel@tzanussi-mobl.amr.corp.intel.com> Subject: Re: [PATCH v9 07/22] tracing: Add lock-free tracing_map From: Tom Zanussi To: Peter Zijlstra Cc: rostedt@goodmis.org, daniel.wagner@bmw-carit.de, masami.hiramatsu.pt@hitachi.com, namhyung@kernel.org, josh@joshtriplett.org, andi@firstfloor.org, linux-kernel@vger.kernel.org Date: Thu, 16 Jul 2015 20:51:47 -0500 In-Reply-To: <20150716223246.GP3644@twins.programming.kicks-ass.net> References: <777bd36975a1dd904fd6b72c4048474dd2327a65.1437066836.git.tom.zanussi@linux.intel.com> <20150716174946.GH12596@twins.programming.kicks-ass.net> <1437082905.12633.56.camel@tzanussi-mobl.amr.corp.intel.com> <20150716223246.GP3644@twins.programming.kicks-ass.net> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.10.4 (3.10.4-4.fc20) Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1884 Lines: 48 On Fri, 2015-07-17 at 00:32 +0200, Peter Zijlstra wrote: > On Thu, Jul 16, 2015 at 04:41:45PM -0500, Tom Zanussi wrote: > > On Thu, 2015-07-16 at 19:49 +0200, Peter Zijlstra wrote: > > > On Thu, Jul 16, 2015 at 12:22:40PM -0500, Tom Zanussi wrote: > > > > + for (i = 0; i < elt->map->n_fields; i++) { > > > > + atomic64_set(&dup_elt->fields[i].sum, > > > > + atomic64_read(&elt->fields[i].sum)); > > > > + dup_elt->fields[i].cmp_fn = elt->fields[i].cmp_fn; > > > > + } > > > > + > > > > + return dup_elt; > > > > +} > > > > > > So there is a lot of atomic64_{set,read}() in this patch set, what kind > > > of magic properties do you assume they have? > > > > > > Note that atomic*_{set,read}() are weaker than {WRITE,READ}_ONCE(), so > > > if you're assuming they do that, you're mistaken -- although it is on a > > > TODO list someplace to go fix that. > > > > Not assuming any magic properties - I just need an atomic 64-bit counter > > for the sums and that's the API for setting/reading those. When reading > > a live trace the exact sum you get is kind of arbitrary.. > > OK, so atomic64_read() really should provide load consistency (there are > a few archs that lack the READ_ONCE() there). > > But the atomic64_set() does not provide store consistency, and in the > above case it looks like the value you're writing is not exposed yet to > concurrency so it doesn't matter how it issues the store. > Right, that's correct. > So as long as you never atomic64_set() a value that is subject to > concurrent modification you should be good. Yeah, and that's the case elsewhere as well. Thanks for clarifying, Tom -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/