Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3259995imu; Mon, 28 Jan 2019 01:29:07 -0800 (PST) X-Google-Smtp-Source: ALg8bN7mT4IF7Y2ScLlvY9bpVS4oUOlmx27PNBc9HzwUjE8mmJeBBwPlp2+mhYDEqphxQSmvfDeA X-Received: by 2002:a17:902:930b:: with SMTP id bc11mr21542688plb.17.1548667747268; Mon, 28 Jan 2019 01:29:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548667747; cv=none; d=google.com; s=arc-20160816; b=rRdAttK647peYve9V99P9oDAGUKDlsgnXdK3EnVnYMwYhOegHMtb9pAA7VulPjdadi hmaUi8Hfe7vh+wOUU3YlQXgN6XqwQ8GmyBBjmAoGniK12By2LWm+6i+uj3dsobEPZEEj +16MeBlWfnY5pOOPNJ6wY2joWLcZPlDOA5jb7Y4Ipcfn4sVBtRB5xyfnsmQykkezLstu EdXym5HN6RFJwVWViZxTFxyOkQ9vn61T6hKFhPs1+UYpl9ja7iAH8GXosoJ4U3wQPTEi pWAviv6/QjJuRj0fui5tJPOhTsOEGHpMiqRzbROkpJvklaVfMP0ENVTm574VLakgmVS4 WAWw== 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:dkim-signature; bh=q07BdVLL3C99fU5+GZcl5MQksCE2HUN5ZMQmAGIoYN0=; b=xVuhQY06VZlg41IiXiR/PvszGiUAF5RAGatr4VDo+c0zojQnnpfKoBxPJ3k9qHPbOp wVzM4DjtIstgLR1b0CxXjAhN4y79yhd4p+3RUMnvZ8lLI4cuBCqwDU2pDg8UsWu0yxGq i4tF34Gff1vUal09ujag2fluMEHbUaHuvmY5+0ZhepnZLosbXTfWkZGwohl2V+efTaKg cVhzR5zPnNUWv3Allw/gCRdYl3UKgwW5QrzZviXDCoKYJQFdAoVDBvl0/E5+9hVHpPdd LsraOJxzXKb+dSUrF3hmjkLvrHxxlK1uSiMs0+SEKoouxgEVeQkReQ3TDwv15et4WZpp i5hA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=merlin.20170209 header.b=XMyKgx8V; 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 g5si17760023plo.108.2019.01.28.01.28.52; Mon, 28 Jan 2019 01:29:07 -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; dkim=fail header.i=@infradead.org header.s=merlin.20170209 header.b=XMyKgx8V; 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 S1726839AbfA1J2S (ORCPT + 99 others); Mon, 28 Jan 2019 04:28:18 -0500 Received: from merlin.infradead.org ([205.233.59.134]:33780 "EHLO merlin.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726369AbfA1J2R (ORCPT ); Mon, 28 Jan 2019 04:28:17 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=merlin.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:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=q07BdVLL3C99fU5+GZcl5MQksCE2HUN5ZMQmAGIoYN0=; b=XMyKgx8VAHbVNB+UmtHmmJznF C0GcNUhwUcoM+5f7dMSZo/NGqQl7cNc5XxNSt0XC8YkJ/A/2ZcaYeeUQ92Xl41XMAs+calSFJiIA7 I2u5YmXOqDVp1FOEboNVHjy6ui1QmLCfS/dQhJbEL+X4DKaPLQirUJc5pqUGew8pntstqSNeJWBaS FeJuUvr7MtlhASwaMgBfodecqw25ybj/Hfvuup1TZL766b5QWgbJZUVlw93FK5rOL/Wippxibl+07 pgaQWa6hX5iuf5EB4iPRmdE83Dlt80Lrm9geRhLk9pmBJ1XkT52oXUzDliyF/A2eekgHQoVwv5kIQ QIx1yN39g==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=hirez.programming.kicks-ass.net) by merlin.infradead.org with esmtpsa (Exim 4.90_1 #2 (Red Hat Linux)) id 1go3D0-000615-58; Mon, 28 Jan 2019 09:28:02 +0000 Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 8A92820101B91; Mon, 28 Jan 2019 10:28:00 +0100 (CET) Date: Mon, 28 Jan 2019 10:28:00 +0100 From: Peter Zijlstra To: "Reshetova, Elena" Cc: Alan Stern , Dmitry Vyukov , Andrea Parri , Kees Cook , "Paul E. McKenney" , Will Deacon , Andrew Morton , Andrey Ryabinin , Anders Roxell , Mark Rutland , LKML Subject: Re: [PATCH] kcov: convert kcov.refcount to refcount_t Message-ID: <20190128092800.GE28467@hirez.programming.kicks-ass.net> References: <20190121131816.GC17749@hirez.programming.kicks-ass.net> <20190122090456.GE13777@hirez.programming.kicks-ass.net> <2236FBA76BA1254E88B949DDB74E612BA4B944B3@IRSMSX102.ger.corp.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <2236FBA76BA1254E88B949DDB74E612BA4B944B3@IRSMSX102.ger.corp.intel.com> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, Jan 27, 2019 at 06:41:38PM +0000, Reshetova, Elena wrote: > > On Mon, Jan 21, 2019 at 11:05:03AM -0500, Alan Stern wrote: > > > On Mon, 21 Jan 2019, Peter Zijlstra wrote: > > Yes, that's a very good suggestion. > > > > I suppose we can add smp_acquire__after_ctrl_dep() on the true branch. > > Then it reall does become rel_acq. > > > > A wee something like so (I couldn't find an arm64 refcount, even though > > I have distinct memories of talk about it). > > > > This isn't compiled, and obviously needs comment/documentation updates > > to go along with it. > > > > --- > > arch/x86/include/asm/refcount.h | 9 ++++++++- > > lib/refcount.c | 7 ++++++- > > 2 files changed, 14 insertions(+), 2 deletions(-) > > > > diff --git a/arch/x86/include/asm/refcount.h b/arch/x86/include/asm/refcount.h > > index dbaed55c1c24..6f7a1eb345b4 100644 > > --- a/arch/x86/include/asm/refcount.h > > +++ b/arch/x86/include/asm/refcount.h > > @@ -74,9 +74,16 @@ bool refcount_sub_and_test(unsigned int i, refcount_t *r) > > > > static __always_inline __must_check bool refcount_dec_and_test(refcount_t *r) > > { > > - return GEN_UNARY_SUFFIXED_RMWcc(LOCK_PREFIX "decl", > > + bool ret = GEN_UNARY_SUFFIXED_RMWcc(LOCK_PREFIX "decl", > > > > REFCOUNT_CHECK_LT_ZERO, > > r- > > >refs.counter, e, "cx"); > > + > > + if (ret) { > > + smp_acquire__after_ctrl_dep(); > > + return true; > > + } > > + > > + return false; > > } > > Actually as I started to do this, any reason why the change here only > for dec_and_test and not for sub_and _test also? Should not the arch. > specific logic follow the generic? Yes, sub_and_test also needs it; I simply overlooked it.