Received: by 2002:a25:31c3:0:0:0:0:0 with SMTP id x186csp3775835ybx; Mon, 4 Nov 2019 02:43:30 -0800 (PST) X-Google-Smtp-Source: APXvYqxRCje8CEHT1owvG3ToIspNV73Qv8erOsTDCXOOgWfZBoXr9WB6KNoyxIrEsvhzxvxPycBK X-Received: by 2002:a17:906:4e55:: with SMTP id g21mr23822794ejw.0.1572864209954; Mon, 04 Nov 2019 02:43:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1572864209; cv=none; d=google.com; s=arc-20160816; b=uGdFh9mxkdkzPiFHNS+eyAx9RqiDQdIuoHI1YYe923urFyylsWZ7y3mnQZnd6Rlku4 Jgpg0qUrjQ0+tTnahI01a9Zqdb8+SThaDJ3Yr9/DFzg//fy7cUnpWxRzK0ObMCRBQx6M WySMgC7AVe3aeLAT1/87tEChOOhxBNCbKnQ/EAtUi481q9og5pEuwpzivUJmB5SwQH2n BqaEjg+Mio1EWst6EpMSDhZaM6Ykp5q8x0k24CMDkZQfbyRgtNu/pMaawTGOa8t839qK e8fZbearA3pZwribAb0nTqQlVwYD1bck5dkNdzBR6CtWRSi/1qAW51h+Z4hPHtTogTBb SXQw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:message-id:date:references :in-reply-to:subject:cc:to:from; bh=47sfmWtf5d5avcPUZfFrNpmcXJAFVW0xS3kOTUGadps=; b=wP7rPMyKgZFuCwc/QcEvXqp835Ia7XA3C1n8VwTYQTqcsT7+1Z0njzZwcRgFoMzvTB iRV9KweYDShOj6m/oPlWD8knIq8DpcwhsnqgSJU5eIMUTo49Jle7yUNII0jmpojPJd+8 D7PMOXFzOln66Cv1pK7y5FyFeHUFvSrgJvYk4/HopW8wW8HYPONB9RP2dXSdnZFRNYNn dgVtj4Vk3MU69boyLGfxE3pGJ2MI9qLgRvK+DLDpZPZ3/2RxEIhJYmdpL4c0oBJCbJPZ thKq0d0nCSqUcuPfllDP5MLcSOWNzwMlyPsp5Iumtfo4/koL/Pn/JtehYzAczj/hgF8D sHSA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l3si10649243ejc.213.2019.11.04.02.43.05; Mon, 04 Nov 2019 02:43:29 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728012AbfKDKkK (ORCPT + 99 others); Mon, 4 Nov 2019 05:40:10 -0500 Received: from mga07.intel.com ([134.134.136.100]:36340 "EHLO mga07.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726633AbfKDKkK (ORCPT ); Mon, 4 Nov 2019 05:40:10 -0500 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by orsmga105.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 04 Nov 2019 02:40:09 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.68,266,1569308400"; d="scan'208";a="200459764" Received: from um.fi.intel.com (HELO um) ([10.237.72.57]) by fmsmga007.fm.intel.com with ESMTP; 04 Nov 2019 02:40:06 -0800 From: Alexander Shishkin To: Peter Zijlstra Cc: Arnaldo Carvalho de Melo , Ingo Molnar , linux-kernel@vger.kernel.org, jolsa@redhat.com, adrian.hunter@intel.com, mathieu.poirier@linaro.org, mark.rutland@arm.com, alexander.shishkin@linux.intel.com Subject: Re: [PATCH v3 1/3] perf: Allow using AUX data in perf samples In-Reply-To: <20191104084024.GZ4131@hirez.programming.kicks-ass.net> References: <20191025140835.53665-1-alexander.shishkin@linux.intel.com> <20191025140835.53665-2-alexander.shishkin@linux.intel.com> <20191028162712.GH4097@hirez.programming.kicks-ass.net> <87tv7sg5ml.fsf@ashishki-desk.ger.corp.intel.com> <20191104084024.GZ4131@hirez.programming.kicks-ass.net> Date: Mon, 04 Nov 2019 12:40:05 +0200 Message-ID: <87y2wvexh6.fsf@ashishki-desk.ger.corp.intel.com> MIME-Version: 1.0 Content-Type: text/plain Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Peter Zijlstra writes: > On Mon, Oct 28, 2019 at 07:08:18PM +0200, Alexander Shishkin wrote: > >> > @@ -6318,11 +6318,12 @@ static void perf_aux_sample_output(struc >> > >> > /* >> > * Guard against NMI hits inside the critical section; >> > - * see also perf_aux_sample_size(). >> > + * see also perf_prepare_sample_aux(). >> > */ >> > WRITE_ONCE(rb->aux_in_sampling, 1); >> > + barrier(); >> >> Isn't WRITE_ONCE() barrier enough on its own? My thinking was that we >> only need a compiler barrier here, hence the WRITE_ONCE. > > WRITE_ONCE() is a volatile store and (IIRC) the compiler ensures order > against other volatile things, but not in general. > > barrier() OTOH clobbers all of memory and thereby ensures nothing can > get hoised over it. > > Now, the only thing we do inside this region is an indirect call, which > on its own already implies a sync point for as long as the compiler > cannot inline it, so it might be a bit paranoid on my end (I don't think > even LTO can reduce this indirection and cause inlining). I see what you mean. I was only thinking about not having to order the AUX STOREs vs the rb->aux_in_sampling. Ordering the call itself makes sense. Thanks, -- Alex