Received: by 2002:a25:d7c1:0:0:0:0:0 with SMTP id o184csp3957614ybg; Mon, 28 Oct 2019 23:26:03 -0700 (PDT) X-Google-Smtp-Source: APXvYqyUH62Skp5oCPE8nr9IBYeX9hsMyabd1WGVNYiu4Vu90KAEyZmnvv39UomJ+kG4/swK8vfo X-Received: by 2002:a17:906:1cce:: with SMTP id i14mr1546960ejh.296.1572330362952; Mon, 28 Oct 2019 23:26:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1572330362; cv=none; d=google.com; s=arc-20160816; b=SIZ0ssrRFYdYTMKejc8N548wOi77KJge/Fx6Rpq9fJUsDT6PSxL37o+WdYnRLT4taK CMkYKAA6msXAZXVvdq0MwmJVRIFW+IFkV8T7ZXv2mQJP7uYAJ9n+3lcWLcRtyEN5i68R b8EL4Xl1M/rwcaZ/7tQmN/PG+g5et67CH4vBzvcWdvAk7KX/fFcHC7/8xBFvTd8Uko89 LKdrQhWQ10FBBlFNN82rr7Z7cszzKpteQ6Le28TmPBN5aH+bNPI/y2eN2FaCSTqAp5yR R0QOOnABbZ3un9qhWLxemcmoKfOQL8rHLHP3AHcEm6HBB7BqHo86iULeX/BXwqvbNabI lpuQ== 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=E2OO7y2c846HvXUThLcoXc+YJROHROKo/c+pJ5Bwy3A=; b=bcsLjEL+5zhYuncOV0MjYQHWNcPYbXlFOI5YwCllWEbPTINXd25BBBLt5h8LHWD+UF 6t7kaCY0XZfR1MFYM0n4gxnYCpDHvoDjoC4IfXoZeQe6D7slUojRRWtywJUSFf8x/pAe SgSlqrgk1DpyHgHww7ujO+kwhA628+VINVSq7wNK70G6W8sgJXLVFkuJ2LvnOUx62sUy qqPNDSbWolQf6dRueRvmNLV/thecGOMuZ4MiAYVJUylh31BvAo7HOrgoQfOHmXoZjpNT bvi6j2hDBxbUW1d8dTraq2h7/bwhZg7TUT1rVbQCLybcQxse0D46NTOTJS9hetJa2gnH D6RQ== 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 x4si4627073ejw.206.2019.10.28.23.25.38; Mon, 28 Oct 2019 23:26:02 -0700 (PDT) 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 S2404057AbfJ1RKZ (ORCPT + 99 others); Mon, 28 Oct 2019 13:10:25 -0400 Received: from mga05.intel.com ([192.55.52.43]:55198 "EHLO mga05.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730243AbfJ1RKY (ORCPT ); Mon, 28 Oct 2019 13:10:24 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by fmsmga105.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 28 Oct 2019 10:10:24 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.68,240,1569308400"; d="scan'208";a="400870656" Received: from um.fi.intel.com (HELO um) ([10.237.72.57]) by fmsmga006.fm.intel.com with ESMTP; 28 Oct 2019 10:10:22 -0700 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: <20191028162840.GD5671@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> <20191028162840.GD5671@hirez.programming.kicks-ass.net> Date: Mon, 28 Oct 2019 19:10:21 +0200 Message-ID: <87r22wg5j6.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 05:27:12PM +0100, Peter Zijlstra wrote: >> And while I get why we need recursion protection for pmu::snapshot_aux, >> I'm a little puzzled on why it is over the padding, that is, why isn't >> the whole of aux_in_sampling inside (the newly minted) >> perf_pmu_snapshot_aux() ? > > That is, given the previous delta, the below. > > --- > --- a/kernel/events/core.c > +++ b/kernel/events/core.c > @@ -6292,9 +6292,17 @@ long perf_pmu_snapshot_aux(struct perf_e > * IRQs need to be disabled to prevent IPIs from racing with us. > */ > local_irq_save(flags); > + /* > + * Guard against NMI hits inside the critical section; > + * see also perf_prepare_sample_aux(). > + */ > + WRITE_ONCE(rb->aux_in_sampling, 1); > + barrier(); > > ret = event->pmu->snapshot_aux(event, handle, size); > > + barrier(); > + WRITE_ONCE(rb->aux_in_sampling, 0); > local_irq_restore(flags); > > return ret; > @@ -6316,13 +6324,6 @@ static void perf_aux_sample_output(struc > if (!rb) > return; > > - /* > - * Guard against NMI hits inside the critical section; > - * see also perf_prepare_sample_aux(). > - */ > - WRITE_ONCE(rb->aux_in_sampling, 1); > - barrier(); > - > size = perf_pmu_snapshot_aux(sampler, handle, data->aux_size); > > /* > @@ -6348,9 +6349,6 @@ static void perf_aux_sample_output(struc > } > > out_clear: > - barrier(); > - WRITE_ONCE(rb->aux_in_sampling, 0); > - > ring_buffer_put(rb); I can't tell without applying these, if the labels still make sense. But this one probably becomes "out_put" at this point. Thanks, -- Alex