Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp2773956pxj; Mon, 31 May 2021 10:23:30 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyUga7D3kL/t1ADEN3aQPKraP5fLZX0f6pkvke53ZeemkWATkguQXsNcKE6xz2pM45vpcRw X-Received: by 2002:a05:6402:4414:: with SMTP id y20mr27380205eda.41.1622481810577; Mon, 31 May 2021 10:23:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1622481810; cv=none; d=google.com; s=arc-20160816; b=OuqpjFVesMCp7cH9NA+LiVD7jzJs8AUtzhKWvznvwwR/tO+gmt1pjQMQAwxjdXzHlQ uaZBk0ZrldJ0kPLlo9ZYgVj2F+SgQaDzJ2MX5FMqjh2QVxkkwzzchosTXMFoO+HuQNDq TIkQ5H4Tv6arsYKSvFDBeambr/Ay68P7yuoW8qQdWFQrxmWzz2DXjr8oJi0qT4pEX9c9 6Jd9FYItJE+shIy5mgNOPwhuhFeYTGrAgN7InkbMn9P4OaJFGE+uGJf94VZxqJI5m2Pd 45LcT7kMGm+P4j9iUqC9it4AacDCv1/BhhcveorW5nzLasjjXH938LKkvo3vzWuxii36 xPbQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=lE1hDy09j0KTbLLoUxbq+EnHpIMPD9qqZ9pibZXYJSo=; b=WiGiwCtkq3Ue0/9hcCQyfyHiuKO45u32YHd51t6yV/YJV5yS4RcyiIJAiR7FCvwvD2 VU3Art6adJG89S5lyI8v8qw3TSXEHka6uac9a8R2CLZ+X27NaAnFemOyE2DSyb5FDncK Tlc0BlOBBCU2U7Qfyla6t10YMhzDFwdMTFPC5x7/otznoJMKM0Jah1l8idLfBh56V04a qZ3dijgtirLl/AHY5i9aB9O3XM9EeF++YhgmlcYF92Mkzy8gcevbqnfppJJAKeJ14koF eEB7bGXTkTqsJ4BM8GCBvf5WWtxOzjAog8OxGrWnqYYxxpu6MLXobQk9P0fhIKZbCt3Y fbHA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=cdbrjCof; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id z5si12142596edc.206.2021.05.31.10.23.07; Mon, 31 May 2021 10:23:30 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=cdbrjCof; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232356AbhEaRXg (ORCPT + 99 others); Mon, 31 May 2021 13:23:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52818 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231483AbhEaRXa (ORCPT ); Mon, 31 May 2021 13:23:30 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6C15EC06F0FB; Mon, 31 May 2021 08:48:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.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; bh=lE1hDy09j0KTbLLoUxbq+EnHpIMPD9qqZ9pibZXYJSo=; b=cdbrjCofYVR4z6XzntlRc1H8if KOb7UEPFcTKzI0bvgdDUPGOygzYUWpZ9wmdZUVCXXW04uerqFjYiXw+3J5oQpSaJ2bmryxZvHkp3D /9i8qnXS29fU8M7Pvep/rFS1rvOEeATQYowxNjzdcsXZhYimlo5VKHSVH5qzjeIvULUy/XEIVDtAc DU0OO7O0OrTZBfrkXTlwGd4DJjLRqHHYTOoj4+TBMFaWHK1CAIfun6U0MgefBpbNVxfSwn7UDGKU2 l4l5V1MknQl1W+DfrK/cI04fPOZnh5nq6wQTH6V7s36kFZZq0cLznduB6fbRJOftWhS/txBYDHnGh K4PSRk3g==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=noisy.programming.kicks-ass.net) by casper.infradead.org with esmtpsa (Exim 4.94 #2 (Red Hat Linux)) id 1lnk97-009AEz-22; Mon, 31 May 2021 15:48:07 +0000 Received: from hirez.programming.kicks-ass.net (hirez.programming.kicks-ass.net [192.168.1.225]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (Client did not present a certificate) by noisy.programming.kicks-ass.net (Postfix) with ESMTPS id 9581A300223; Mon, 31 May 2021 17:48:03 +0200 (CEST) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 742B020126D07; Mon, 31 May 2021 17:48:03 +0200 (CEST) Date: Mon, 31 May 2021 17:48:03 +0200 From: Peter Zijlstra To: Leo Yan Cc: Adrian Hunter , Arnaldo Carvalho de Melo , Ingo Molnar , Mark Rutland , Alexander Shishkin , Namhyung Kim , Andi Kleen , linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v1 1/2] perf auxtrace: Change to use SMP memory barriers Message-ID: References: <20210519140319.1673043-1-leo.yan@linaro.org> <3c7dcd5d-fddd-5d3b-81ac-cb7b615b0338@intel.com> <7cdc3578-a50e-89ef-477a-3dc1f84f96bb@intel.com> <20210531145302.GC9324@leoy-ThinkPad-X240s> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210531145302.GC9324@leoy-ThinkPad-X240s> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, May 31, 2021 at 10:53:02PM +0800, Leo Yan wrote: > Hi Peter, Adrian, > > On Thu, May 27, 2021 at 11:57:37AM +0200, Peter Zijlstra wrote: > > On Thu, May 27, 2021 at 12:24:15PM +0300, Adrian Hunter wrote: > > > > > > If all we want is a compiler barrier, then shouldn't that be what we use? > > > > i.e. barrier() > > Sorry for a bit late. Just bring up one question before I respin > this patch set. > > > > I guess you are saying we still need to stop potential re-ordering across > > > CPUs, so please ignore my comments. > > > > Right; so the ordering issue is real, consider: > > > > CPU0 (kernel) CPU1 (user) > > > > write data read head > > smp_wmb() smp_rmb() > > write head read data > > One thing should be mentioned is the Linux kernel has _not_ used an > explict "smb_wmb()" between writing AUX trace data and updating header > "aux_head". Please see the function perf_aux_output_end(): I think we pushed that into the driver. There is nothing the generic code can do here. It is the drivers responsibility of ensuring the data is stable before calling perf_aux_output_end() or something along those lines.