Received: by 2002:a25:ca44:0:0:0:0:0 with SMTP id a65csp1416120ybg; Wed, 29 Jul 2020 13:42:34 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzqBPZIJMFO4/MnCMpWDz+KNDoTN64gwh0ouCZhLa6ZPK1C/oSzibHbP5yGqM0ZRHikdKXr X-Received: by 2002:a50:fb06:: with SMTP id d6mr57241edq.165.1596055354004; Wed, 29 Jul 2020 13:42:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1596055353; cv=none; d=google.com; s=arc-20160816; b=km4BJkWMur8N6j/IuUS+YijD9Bbf0TpomdkzHjS/g6fBvIwGfbBfqxGHdV8iy0mPxQ 9W5n/61/SZy0hCmjCGE4eIIi95ddrLDXQDmqin5wIzztp/YJYR2C88fJn7IroFwPh6Jj JqdQZ11SWS/8XAUT/TI9BVeMMuYFxGrEPkKFoNuUup+6OkKaJd1UpnaDvY+XzWjozQXo 74hYb9uTXswWmig73Nda0A28qzokfSM5Y3yb50RBuLQ0gBCegUMXgTPufvmF52ZqT6Mx Apps7JBiHLYLQoKn329h2SDMEv47CW2Lvn7DM2h2dJcGGzXI2/0CySzByCBGYIFPPpVy Kyng== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:content-id:mime-version :subject:cc:to:references:in-reply-to:from:organization :dkim-signature; bh=tz3AJclcgpUUd5Ie5LOD0OGxJo0zoLyE3foe8l24nRs=; b=YxAf9V8BRz9u647z4h4V8iLC1crtGdFeowFajtEapxLssbRQrxMtMbCSkyu6yxBZ3X tS8y+bzc9VZs9ot+CY4Dbf6R7lYFmPPH97j1k2Yt3fu8aJnrM9YY4GJS/LTiIi+ZQPDW c522VDSaBJi5H+knk6VOTtq/kAg7bzMqjWUHmWBfhx93Cu+v/lbpsjJvsJzNBmn0IvlN rRLOkYejO03cFEIRlG6DH+IDH806JY9vnVQAaeo95lyksSgeW65lB/oDWHj8xS98mhaa hGJVE9eLZ+B7CUDBd7BOxq/9SeV+Tbt7Ah5+bJn8DFhW9+u3BoGyYmdL0UH4fEC8AgtT /mMA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=iYGtfwM1; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id h1si2088378edn.53.2020.07.29.13.42.06; Wed, 29 Jul 2020 13:42:33 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=iYGtfwM1; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726869AbgG2Uls (ORCPT + 99 others); Wed, 29 Jul 2020 16:41:48 -0400 Received: from us-smtp-delivery-1.mimecast.com ([207.211.31.120]:44908 "EHLO us-smtp-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726476AbgG2Ulr (ORCPT ); Wed, 29 Jul 2020 16:41:47 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1596055306; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=tz3AJclcgpUUd5Ie5LOD0OGxJo0zoLyE3foe8l24nRs=; b=iYGtfwM1QPF1Eb5HNsD0EOkj2xutyTFT+KM5wYrftob6UEvn+xznLuuVZrDTPpblgAPb1y l0ys5aavG8HhqnUDIFF1l7pM40Y8nVYJdRofYrppBX27/GBJLHLSP/cfAuqk77cuufJdNH 3hsWggVZiv13VhPzWNCKw01HhrL52k0= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-237-RahEJVJbP9CvmEsIJZ3KEQ-1; Wed, 29 Jul 2020 16:41:44 -0400 X-MC-Unique: RahEJVJbP9CvmEsIJZ3KEQ-1 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id B21101083E85; Wed, 29 Jul 2020 20:41:41 +0000 (UTC) Received: from warthog.procyon.org.uk (ovpn-112-32.rdu2.redhat.com [10.10.112.32]) by smtp.corp.redhat.com (Postfix) with ESMTP id 3DFD08A18A; Wed, 29 Jul 2020 20:41:38 +0000 (UTC) Organization: Red Hat UK Ltd. Registered Address: Red Hat UK Ltd, Amberley Place, 107-111 Peascod Street, Windsor, Berkshire, SI4 1TE, United Kingdom. Registered in England and Wales under Company Registration No. 3798903 From: David Howells In-Reply-To: <20200729111120.GA2638@hirez.programming.kicks-ass.net> References: <20200729111120.GA2638@hirez.programming.kicks-ass.net> <20200721195132.GJ10769@hirez.programming.kicks-ass.net> <202006142054.C00B3E9C9@keescook> <20200612183450.4189588-1-keescook@chromium.org> <7be4d56b-0406-099b-e505-02e074c5173e@huawei.com> <544539.1595328664@warthog.procyon.org.uk> <202007211144.A68C31D@keescook> <3211866.1595933798@warthog.procyon.org.uk> To: peterz@infradead.org Cc: dhowells@redhat.com, Kees Cook , Xiaoming Ni , David Windsor , Hans Liljestrand , Elena Reshetova , Paul Moore , edumazet@google.com, paulmck@kernel.org, shakeelb@google.com, James Morris , alex.huangjianhui@huawei.com, dylix.dailei@huawei.com, chenzefeng2@huawei.com, linux-kernel@vger.kernel.org, Will Deacon Subject: Re: [RFC][PATCH] locking/refcount: Provide __refcount API to obtain the old value MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <4041519.1596055297.1@warthog.procyon.org.uk> Date: Wed, 29 Jul 2020 21:41:37 +0100 Message-ID: <4041520.1596055297@warthog.procyon.org.uk> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org peterz@infradead.org wrote: > I'm not entirely sure what you mean with interpret, provided you don't > trigger a refcount fail, the number will be just what you expect and > would get from refcount_read(). If you do trigger a fail, you'll get a > negative value. That's fine. I seem to remember talk about the possibility that the number wouldn't necessarily bottom out at zero - for instance if it was arranged such that the overflow flag was set on an overflow or underflow so that it could be trapped on (using INTO or TRAPV, for example). David