Received: by 2002:a25:31c3:0:0:0:0:0 with SMTP id x186csp3672014ybx; Mon, 4 Nov 2019 00:43:45 -0800 (PST) X-Google-Smtp-Source: APXvYqxqqLByi1zXEvVt2NGyFPHj3mhvTqubMRmlI7xmDp1RI2WQKEDNYl002vzYR9c8tv2nG/et X-Received: by 2002:a17:906:784c:: with SMTP id p12mr12684513ejm.60.1572857024891; Mon, 04 Nov 2019 00:43:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1572857024; cv=none; d=google.com; s=arc-20160816; b=te7sQ5nBA9kgWBnuW+BWX8SmtG3RRGR+zS7XeZHfySkKkR60b1YMzDECu+tve5pbot Uc8dEcenHZRo3xv87k06uR4MqLBEU8uNJr50oWFIqFM73/z3HHO1oQQXYPAVFonU9zhT WWW+HvhdxVbp7bc2WCGkXJ2S4wNOPp0LvKSWrSqXjWcS1cf47lASQnc7ytYFULTrxk91 3E3sWnJvdGG8JG0hXvIRuf0p4Sywjt4TlNW8sgWjFwR1KL7ddGBi42AyYBgLKdvJ8kwE yXhW9Da4SlwkpAqszw2wX86AyosM5rImCQsxxo2srOQVBqdI4Ve4IG/pR7/096iaqg+Z G5xA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=pHINdxeRrniqD93Z7XY51rAt/Snx+07p0RIhPThEcG4=; b=wNz88v5qzHhTl2otLxNUoN5wuN0GTRcpSvwQdPD7xj9MuVHcKDGK+W34oLPhdCuSGX eBKjXE2zwI5Gv/iN1PjpI3/5lBBL0IGCaq+/ZNl5P5sMR5GAzPdNI3mm2nR3YqDTDarR oDpbs9ARy7gE3GNNldP6h1WLwJg36UWg1at7RO601Inn3+TcTKxh4zyl/5/+GqeRDmiI jCx+dqcUjlETIm0qyIwmIPJoQHegb1ujODlMGBPlUsVgjfAfkyqWjNSmTibpkbOE0xtf Dic07QsSKGvPxmRH2jxR+GdEjSqnTK8OWAOHQewWWxmFwvCSmqvyxd0TxscSrkssxW0w t6NQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=CURR3Lfs; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e19si512939ejb.379.2019.11.04.00.43.20; Mon, 04 Nov 2019 00:43:44 -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; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=CURR3Lfs; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727444AbfKDIka (ORCPT + 99 others); Mon, 4 Nov 2019 03:40:30 -0500 Received: from bombadil.infradead.org ([198.137.202.133]:56662 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726441AbfKDIka (ORCPT ); Mon, 4 Nov 2019 03:40:30 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=In-Reply-To:Content-Type:MIME-Version :References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=pHINdxeRrniqD93Z7XY51rAt/Snx+07p0RIhPThEcG4=; b=CURR3LfsSdDaQIKfySpmU+W4E PfYsBIWAwk5+63EqxsMJEo7bqLk/SWV1cafXHaBAIopZ67DILlcTrceULlM8HRbwkg7sSUrGiNwcH if/l9JZ+UY7YbnkQJgjIPb8SlvUhWAHAehQzPe7ITWpsoMpxnsxj+utqzGy5XgRpJbCIc919xZzY4 iupd1Fi5M8xCVeFTq66RnS1hMQaM56ASHaCeohl0wpHk8KuclPaHT5uIRRr1jsLJfeut6N8PQjC93 u6GKoZ0TM6bds7hvNy8lNQ8IEdpVq185Az01OSGgNtEgcpSOWizGfayNgn+8zWJokpst5Pm64VRb0 TFQ+a5JEw==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=noisy.programming.kicks-ass.net) by bombadil.infradead.org with esmtpsa (Exim 4.92.3 #3 (Red Hat Linux)) id 1iRXuU-0000SR-Uu; Mon, 04 Nov 2019 08:40:27 +0000 Received: from hirez.programming.kicks-ass.net (hirez.programming.kicks-ass.net [192.168.1.225]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by noisy.programming.kicks-ass.net (Postfix) with ESMTPS id 2715B305FC2; Mon, 4 Nov 2019 09:39:20 +0100 (CET) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 240B123CEFE81; Mon, 4 Nov 2019 09:40:24 +0100 (CET) Date: Mon, 4 Nov 2019 09:40:24 +0100 From: Peter Zijlstra To: Alexander Shishkin 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 Subject: Re: [PATCH v3 1/3] perf: Allow using AUX data in perf samples Message-ID: <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> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <87tv7sg5ml.fsf@ashishki-desk.ger.corp.intel.com> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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).