Received: by 2002:ac0:8c9a:0:0:0:0:0 with SMTP id r26csp240188ima; Fri, 1 Feb 2019 02:35:13 -0800 (PST) X-Google-Smtp-Source: AHgI3IZjMtSiCeG8c7G8r9u85BkyKLfVruBI/eOwZmLkPYzNLl1vOaiNmwShNa6FZ+Lm1VOf1QZO X-Received: by 2002:a63:f74f:: with SMTP id f15mr1721260pgk.190.1549017313347; Fri, 01 Feb 2019 02:35:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549017313; cv=none; d=google.com; s=arc-20160816; b=08P5sjM/DIlw36qbW0mWtbng3DFUpz2/1F2QEAUl0466S7tePFaL1a5GkiZBTUN+fN oTKbJb8aTeND5JrK2wcOUsdpNyhaqBWXTlyfeI6E7WkaYE8cNQuYLRRAz/quh9VOFvbB 8iyrciSX0mT4QFXUPBg0q3Hnsc5jUzCRjdYV+L+xduDutR+Fud12+ILbgij9r21e5dQs YVh7WvNPDawuvYx9DZyZqnOVyfI5yyfwX1XMOlrjkYuPfAbOju3Rd8rWXEbKeT45fkGG hlk+D7Aqe9PMU2jj9R3BGdb9bnpcsIXQGY6BRRreLJl9zvNOfRwQjwFfD8a8A5scE4zL xxsA== 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; bh=EW5ulRlz7cOlqQYCNGqYPo1blVCNDaOsVAMPZSTrydQ=; b=Qw9CTeDf890rAGkIjTta3FBujL8EqGpaxVYNbOwIuX+8yzRXsLcfjYfdQfcJmj8yco /UWzpewi45M0mrtSiiqZkIVggeVTlQYHNUMQnKLJqjIofRCUGhfeNW1Cty0hFWFwJQUw wJNJrxZdldhU88YyPLgPGkUQ65Jem57QFkUydeXvOrnlGgxIGtytac+N2R8INcBDuZ5b JdkPvSphOIjJmpAaV83sT+2Ek7nCmRPaOnQGEm/RwOS6TauFY7yTsr571kAI0SLufqEl vUgnhXm04k2VTrONAhjxau0HUmmF0kBn3PBuQnPiTa5U05KcsIxySaayRElMJugOmdA+ 0Wvw== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x61si7292707plb.303.2019.02.01.02.34.57; Fri, 01 Feb 2019 02:35:13 -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; 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 S1729671AbfBAKc7 (ORCPT + 99 others); Fri, 1 Feb 2019 05:32:59 -0500 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:57624 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728478AbfBAKc7 (ORCPT ); Fri, 1 Feb 2019 05:32:59 -0500 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id DD29C80D; Fri, 1 Feb 2019 02:32:58 -0800 (PST) Received: from lakrids.cambridge.arm.com (usa-sjc-imap-foss1.foss.arm.com [10.72.51.249]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 18E813F71E; Fri, 1 Feb 2019 02:32:56 -0800 (PST) Date: Fri, 1 Feb 2019 10:32:54 +0000 From: Mark Rutland To: "Reshetova, Elena" Cc: Peter Zijlstra , "linux-kernel@vger.kernel.org" , "mingo@redhat.com" , "acme@kernel.org" , "namhyung@kernel.org" , "alexander.shishkin@linux.intel.com" , "jolsa@redhat.com" , "keescook@chromium.org" , "tglx@linutronix.de" Subject: Re: [PATCH 1/3] perf: convert perf_event_context.refcount to refcount_t Message-ID: <20190201103254.GB31409@lakrids.cambridge.arm.com> References: <1548678448-24458-1-git-send-email-elena.reshetova@intel.com> <1548678448-24458-2-git-send-email-elena.reshetova@intel.com> <20190129093748.GF28467@hirez.programming.kicks-ass.net> <2236FBA76BA1254E88B949DDB74E612BA4B98D3A@IRSMSX102.ger.corp.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <2236FBA76BA1254E88B949DDB74E612BA4B98D3A@IRSMSX102.ger.corp.intel.com> User-Agent: Mutt/1.11.1+11 (2f07cb52) (2018-12-01) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Jan 29, 2019 at 01:55:32PM +0000, Reshetova, Elena wrote: > > On Mon, Jan 28, 2019 at 02:27:26PM +0200, Elena Reshetova wrote: > > > diff --git a/kernel/events/core.c b/kernel/events/core.c > > > index 3cd13a3..a1e87d2 100644 > > > --- a/kernel/events/core.c > > > +++ b/kernel/events/core.c > > > @@ -1171,7 +1171,7 @@ static void perf_event_ctx_deactivate(struct > > perf_event_context *ctx) > > > > > > static void get_ctx(struct perf_event_context *ctx) > > > { > > > - WARN_ON(!atomic_inc_not_zero(&ctx->refcount)); > > > + WARN_ON(!refcount_inc_not_zero(&ctx->refcount)); > > > > This could be refcount_inc(), remember how that already produces a WARN > > when we try and increment 0. > > But is this true for the x86 arch-specific implementation also? If you use recount_inc_checked(), it will always produce the WARN(), even when using the x86-specific refcount implementation. (this was one place I had intended to use the *_checked() forms of the refcount ops). Thanks, Mark.