Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp235768yba; Tue, 14 May 2019 23:53:58 -0700 (PDT) X-Google-Smtp-Source: APXvYqwH5HWK7bSmeiMIRPMBQGz2j325xZ2YkUC9m/jumCMfui6QnBpx9MJKbUetyOhiB8+DNh9V X-Received: by 2002:a17:902:ba8d:: with SMTP id k13mr28419680pls.52.1557903237988; Tue, 14 May 2019 23:53:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1557903237; cv=none; d=google.com; s=arc-20160816; b=TbOLNgNZ+Ts8MIdVET5te2qbk23NXgTUgnlyEWFlSLjB4NEe0WN6vwdv1Pi29PYzwy SNkHr2TDIo8cUKNr76wzhwhLl1XwHQVuc7NhXqxYUAzh3RLSibv4D9bPIUzIC03dKJAM qG1G50r/fw7w9olGdqi/deGGoDGKx8eTzPZpgBK30Vg6Kt55e2qVZJvwAaDOBbOL9nP+ aEj+HOuTbG9hz8A2DsXNctU4nBnnEtCmm89SRUawvyPiYWvQle3IuxkfsADypbin+3Uo foJmYqJ7U0sx9f2SOzpgxyVDhBujdgU/vgVbvd3P7UXzKWSkI3/4ZiGjE2uFV9abhQq8 d/Ow== 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=QHUldFWlaPbI6/mLyQdmlhIKLb5PB8yFjgKOL3klEhQ=; b=HQU02AMmZ7X3+/7jP1Nk9/MhXeNHFF7rFhojAWm2ysSixYUM2URZG52e0VlmtpU9GX nes/zMY11UkvaCdNJSAV80ysWV/8+7FMl/LHof0iMULyDiqgkAEEw03Afl7OHV9TEQ9K nkizTyXnYywMq83xP+ky++iM5ycWCB0+tsXIGqMOw3+naL/dUZgNVQdyDox80r15AlXf zeD1kP/+jmyfYuPeAWZZtx8ok7HvgdyhDxPyWSGA3P57zNDZXCtjjSddx8ALIcXYt0TY 82Cj0TJN90IzxsJ8OdXx2NKiJX5Mc0rV1TLAhxyP+cCzQYJ0eE5HHMiuLdIHt8c1Iaze Ti0A== 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 h8si1068852pgm.134.2019.05.14.23.53.42; Tue, 14 May 2019 23:53:57 -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 S1726122AbfEOGvK (ORCPT + 99 others); Wed, 15 May 2019 02:51:10 -0400 Received: from mga01.intel.com ([192.55.52.88]:57740 "EHLO mga01.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725781AbfEOGvK (ORCPT ); Wed, 15 May 2019 02:51:10 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga101.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 14 May 2019 23:51:10 -0700 X-ExtLoop1: 1 Received: from um.fi.intel.com (HELO localhost) ([10.237.72.63]) by FMSMGA003.fm.intel.com with ESMTP; 14 May 2019 23:51:08 -0700 From: Alexander Shishkin To: Yabin Cui , Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Jiri Olsa , Namhyung Kim Cc: linux-kernel@vger.kernel.org, Yabin Cui , alexander.shishkin@linux.intel.com Subject: Re: [PATCH] perf/ring_buffer: Fix exposing a temporarily decreased data_head. In-Reply-To: <20190515003059.23920-1-yabinc@google.com> References: <20190515003059.23920-1-yabinc@google.com> Date: Wed, 15 May 2019 09:51:07 +0300 Message-ID: <87ef50xlb8.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 Yabin Cui writes: > diff --git a/kernel/events/ring_buffer.c b/kernel/events/ring_buffer.c > index 674b35383491..0b9aefe13b04 100644 > --- a/kernel/events/ring_buffer.c > +++ b/kernel/events/ring_buffer.c > @@ -54,8 +54,10 @@ static void perf_output_put_handle(struct perf_output_handle *handle) > * IRQ/NMI can happen here, which means we can miss a head update. > */ > > - if (!local_dec_and_test(&rb->nest)) > + if (local_read(&rb->nest) > 1) { > + local_dec(&rb->nest); What stops rb->nest changing between local_read() and local_dec()? Regards, -- Alex