Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp5586695ybi; Tue, 4 Jun 2019 08:51:04 -0700 (PDT) X-Google-Smtp-Source: APXvYqyozzCy+X5Tck7s6d8a1XPBpE/4rSd5IoXZuS4Vn1OQo8OAkW907vVeBsqLxF6totgEEse6 X-Received: by 2002:a65:60d9:: with SMTP id r25mr12337320pgv.228.1559663464169; Tue, 04 Jun 2019 08:51:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559663464; cv=none; d=google.com; s=arc-20160816; b=KaiPp6ClZ7+LchjNowzmmsB0Ra/ppHGit42R4QijJWE3LXT3RRDgpGTsej7GWdyckX 9iAGELiMbzWUiVBWMnqyOBxiszdKAZlm52t2luOtpSdsu5CxLeeE8AvYnYtI67zkPY79 oSBBkG1Ml453WB23AYCIVcuK68FbCUELl/EVDmihAEJX71UPuZCUBkGV6O3K7ybnMirO FuSXiF6y0L/bePN/6CKt8ceqKixI8QIoYFSuYkHztXOQB7G42c+t/HDD+nzFDngHX/PC VCFoFbCmx9BsqbPfuRCdtYbCqNUPqwGYjx6rp+eUzd8BZJ81Y9DyEBDPtNaGgCrmX6VY Glvw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-language :content-transfer-encoding:in-reply-to:mime-version:user-agent:date :message-id:organization:from:references:cc:to:subject; bh=9HyYhFCwcSoFnChYKbDuzOBJfkzt79GdyuZwlK4RTbQ=; b=ulD7Ll3rvI8cC4WaxPsBq4U0C685TVAtFO/iKfxF3KhQ06iEYt/df3ogOd0tlsymgy PtyDzjxcqnf3ro/RqEHKG3r9rPwqD/2qmD79ruapngTO7Q9xcJULDYx7LQY0PM7vW1NS Udd+8zFI/yClHGjkvxtPzH7apGTNPn3x0kbuql48NcJa8+oiII8CEFevJCqxGC2ZMQCh z1vAIg5BbOZRr0G9cQ/MxLH6atfhXiozZPpR0keE2rtgGcfCgWDU3yF9/+RxqnHZ05rZ xJPLZ/egnQTKwnyP4ykXijuKvzoQuU1L+iA9jiiztFBqGJSG88YDkIzbvWHqZMBmV52C h34g== 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=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z17si22678974pgl.339.2019.06.04.08.50.46; Tue, 04 Jun 2019 08:51:04 -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=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728191AbfFDPr3 (ORCPT + 99 others); Tue, 4 Jun 2019 11:47:29 -0400 Received: from mx1.redhat.com ([209.132.183.28]:5657 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728019AbfFDPr3 (ORCPT ); Tue, 4 Jun 2019 11:47:29 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 296D43087BA9; Tue, 4 Jun 2019 15:47:24 +0000 (UTC) Received: from llong.remote.csb (dhcp-17-85.bos.redhat.com [10.18.17.85]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0760F5C206; Tue, 4 Jun 2019 15:47:21 +0000 (UTC) Subject: Re: [PATCH v8 17/19] locking/rwsem: Merge owner into count on x86-64 To: Peter Zijlstra Cc: Ingo Molnar , Will Deacon , Thomas Gleixner , Borislav Petkov , "H. Peter Anvin" , linux-kernel@vger.kernel.org, x86@kernel.org, Davidlohr Bueso , Linus Torvalds , Tim Chen , huang ying References: <20190520205918.22251-1-longman@redhat.com> <20190520205918.22251-18-longman@redhat.com> <20190604094537.GK3402@hirez.programming.kicks-ass.net> From: Waiman Long Organization: Red Hat Message-ID: Date: Tue, 4 Jun 2019 11:47:21 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.6.1 MIME-Version: 1.0 In-Reply-To: <20190604094537.GK3402@hirez.programming.kicks-ass.net> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Content-Language: en-US X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.45]); Tue, 04 Jun 2019 15:47:29 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 6/4/19 5:45 AM, Peter Zijlstra wrote: > On Mon, May 20, 2019 at 04:59:16PM -0400, Waiman Long wrote: >> With separate count and owner, there are timing windows where the two >> values are inconsistent. That can cause problem when trying to figure >> out the exact state of the rwsem. For instance, a RT task will stop >> optimistic spinning if the lock is acquired by a writer but the owner >> field isn't set yet. That can be solved by combining the count and >> owner together in a single atomic value. > I just realized we can use cmpxchg_double() here (where available of > course). Does the 2 doubles need to be 128-bit aligned to use cmpxchg_double()? I don't think we can guarantee that unless we explicitly set this alignment. Cheers, Longman