From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-14.0 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 07753C47094 for ; Mon, 7 Jun 2021 15:29:18 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id C827061185 for ; Mon, 7 Jun 2021 15:29:14 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org C827061185 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=uuUUAkP/fcUZ676nd/eY3lpY4LX6aJpnPV53DvDe0cU=; b=2d23ooYgPKTvsM /MZaHXOvn8PapZCl/TaraVlPiY++jraqoKxaq89gWxxs0OaZ49FKkR7Qr6+N79a613TSrUhgweIui 9eCvXfFXSL7gxzOCHi0wQBXembjcSDg5oI0ZQxnwnFGR+4q7zHnq0HB8dCK2g7UR8CuLLRvAwq4Mo dYQQvpn8ee+vhBFPhujjINqlP5yLLrH9tGoFspYkEgFzUpuwCD10/LdJNHlTUlV2aGzLrziXa50u9 Ndsdqi9z2m4k/cvJBV7Pq1YMyJn6ayZyJb0+U/qnkaxlZhI0DJwY4Xg1Q9PJBamK0TuVrvTZzhtw5 qB7tzk+BhYXaOh6tAl1w==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1lqHA6-004EvP-MR; Mon, 07 Jun 2021 15:27:34 +0000 Received: from desiato.infradead.org ([2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1lqHA4-004EvF-8z for linux-arm-kernel@bombadil.infradead.org; Mon, 07 Jun 2021 15:27:32 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; 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=gJrY6iiGPzs6iGJKkNIy3WHBh9VoBLb6vQTSmNqRX4M=; b=qjScuI46Voo5bgA7/vt0xcCSCz rpjDXQLHNoBHCEagaipTugxCf/hT9KxBbNebPYG2QYkpHaP+6X47MSVt8pLBTmMqh5Kzn+IPVCWdt gkAwSRco+ALgHAz3RroyqbGcvnJvVBepOjL0dOMXjGF5/EtWBsUmnVoD1fyir1uUqdYDujiJf4Qbl gKvFtE0JjVTHV01CqTwZenT6PKYmOrFGd562ZQEp9UdjJ7Ugs9s4McvNSBS2JNvPyK7W4g5xsFYnH U9zFYsap9OQWY6cvbkmlPq1N+yi8hqmzqCHQZhHxWBtJGgUknjAl+kblXvLX+UaVL+uJJinUIAX07 HEc+ZKmQ==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=noisy.programming.kicks-ass.net) by desiato.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1lqH9t-004RfL-MR; Mon, 07 Jun 2021 15:27:28 +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)) (Client did not present a certificate) by noisy.programming.kicks-ass.net (Postfix) with ESMTPS id 36C7F3001E3; Mon, 7 Jun 2021 17:27:26 +0200 (CEST) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id E67F92D6A7343; Mon, 7 Jun 2021 17:27:25 +0200 (CEST) Date: Mon, 7 Jun 2021 17:27:25 +0200 From: Peter Zijlstra To: Leo Yan Cc: Arnaldo Carvalho de Melo , Ingo Molnar , Mark Rutland , Alexander Shishkin , Jiri Olsa , Namhyung Kim , Thomas Gleixner , x86@kernel.org, "H. Peter Anvin" , Mathieu Poirier , Suzuki K Poulose , Mike Leach , Adrian Hunter , Andi Kleen , linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org, coresight@lists.linaro.org, linux-arm-kernel@lists.infradead.org Subject: Re: [PATCH v2 1/8] perf/ring_buffer: Add comment for barriers on AUX ring buffer Message-ID: References: <20210602103007.184993-1-leo.yan@linaro.org> <20210602103007.184993-2-leo.yan@linaro.org> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20210602103007.184993-2-leo.yan@linaro.org> X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Wed, Jun 02, 2021 at 06:30:00PM +0800, Leo Yan wrote: > AUX ring buffer applies almost the same barriers as perf ring buffer, > but there has an exception for ordering between writing the AUX trace > data and updating user_page::aux_head. > > This patch adds comment for how to use the barriers on AUX ring buffer, > and gives comment to ask the drivers to flush the trace data into AUX > ring buffer prior to updating user_page::aux_head. > > Signed-off-by: Leo Yan Acked-by: Peter Zijlstra (Intel) > --- > kernel/events/ring_buffer.c | 9 +++++++++ > 1 file changed, 9 insertions(+) > > diff --git a/kernel/events/ring_buffer.c b/kernel/events/ring_buffer.c > index 52868716ec35..5cf6579be05e 100644 > --- a/kernel/events/ring_buffer.c > +++ b/kernel/events/ring_buffer.c > @@ -509,6 +509,15 @@ void perf_aux_output_end(struct perf_output_handle *handle, unsigned long size) > perf_event_aux_event(handle->event, aux_head, size, > handle->aux_flags); > > + /* > + * See perf_output_put_handle(), AUX ring buffer applies the same > + * barrier pairing as the perf ring buffer; except for B, since > + * AUX ring buffer is written by hardware trace, we cannot simply > + * use the generic memory barrier (like smp_wmb()) prior to update > + * user_page::aux_head, the hardware trace driver takes the > + * responsibility to ensure the trace data has been flushed into > + * the AUX buffer before calling perf_aux_output_end(). > + */ > WRITE_ONCE(rb->user_page->aux_head, rb->aux_head); > if (rb_need_aux_wakeup(rb)) > wakeup = true; > -- > 2.25.1 > _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel