Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp5669005ybi; Tue, 4 Jun 2019 10:07:46 -0700 (PDT) X-Google-Smtp-Source: APXvYqyuhuKxAfBOMsKIE4MzPUSRevlIerSHiQp7tu9JnxSVPq6G/PVjpoHH2wpGT9kTV6DfyVoa X-Received: by 2002:a62:b50c:: with SMTP id y12mr33493610pfe.171.1559668066285; Tue, 04 Jun 2019 10:07:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559668066; cv=none; d=google.com; s=arc-20160816; b=CSGu9e6ov11l7KKcstSLRSvRAiPs+aAZ/AMIf0JYThjde4gPnhnZ1XiYpc3OdPAGMv gnm3tSL3RGr7V2/r8lgZ9Y7T7y7PDUEHfaLX+QtRx+uDqBCYsAJHeMSd3zxH5kYpbbQU i6144zdyvg0zA+j60bEM5jd09BsPruuxTik1U4zSwHwC8XL2OWqGJV8QyFWJOyUyypcd OwYq7eXk8ZrJ3MbeUxDByudn3v2hJfZtUIo5EcBKdG89Xx381hK1R2zW7FguJetbG0rh VTIKuah9WyYE0eHi3xKuzZsbiE2nDZmTtJnw5o64VBlIBhHB8xc1zJvCV/yX9yCbiWjt qQ5g== 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=s+LKngRnG4qYTS8VgAn23mT2WmaNRwUmEKHYeX0pDzQ=; b=imlha0Gi7MvdDYo1XluLFyZ6K2v+7JMGYNGLSlV04eAmuLQMmMmh42nhhyl65LWrR8 /BAX8LDLjVb1bE1HUrj6JTFyYQsA/IOyzJLgWdvSX1QgPjIHv8bf3BFVTa+QUcwogWVA tEIwvqvlP10zbabsXyZ7+XjA9t5aE8uGHLchXSZkSuRiSq4/Mvmef3hIMHw4+Zs/Kfhf t7proEjtjPywlYp+70pqcD+pwEFyyzq93LrLLHoeje4bw12xBWO5bKtqt/A0dZR5CdvW m8OpN4MwqOzruQd2JvBicIubw6eHzNFUUc5eQBmQd93/mX3tKLV1L19oJuHbgHAKQhtI X4+w== 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 m129si1874496pfm.118.2019.06.04.10.07.29; Tue, 04 Jun 2019 10:07:46 -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 S1727905AbfFDRGP (ORCPT + 99 others); Tue, 4 Jun 2019 13:06:15 -0400 Received: from mx1.redhat.com ([209.132.183.28]:35990 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727715AbfFDRGP (ORCPT ); Tue, 4 Jun 2019 13:06:15 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id E7E3281E0A; Tue, 4 Jun 2019 17:06:14 +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 BF20C1001DFD; Tue, 4 Jun 2019 17:06:11 +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> <20190604170218.GE3419@hirez.programming.kicks-ass.net> From: Waiman Long Organization: Red Hat Message-ID: <28a6c7b5-c40e-1c89-03e2-688c1135f3b5@redhat.com> Date: Tue, 4 Jun 2019 13:06:11 -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: <20190604170218.GE3419@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.84 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Tue, 04 Jun 2019 17:06:15 +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 1:02 PM, Peter Zijlstra wrote: > On Tue, Jun 04, 2019 at 11:47:21AM -0400, Waiman Long wrote: >> 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. > It does :/ and yes, we'd need to play games with __align(2*sizeof(long)) > and such. So do you want this as an option now as it will be x86 specific? Or we can do that as a follow-up if we want to. Cheers, Longman