Received: by 2002:ac0:8c9a:0:0:0:0:0 with SMTP id r26csp5522383ima; Tue, 5 Feb 2019 13:14:09 -0800 (PST) X-Google-Smtp-Source: AHgI3IaOGGhCxQc49JubWgl1KGl7yvQ779FnT/KVw+bo4yNx5eZWpIjh/klkaV+Xvkhue9xAE1KS X-Received: by 2002:a65:488a:: with SMTP id n10mr6490888pgs.261.1549401249096; Tue, 05 Feb 2019 13:14:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549401249; cv=none; d=google.com; s=arc-20160816; b=heCIcSpSuABs8pnnInQCxao0OOwLpQl4AXz6oVRfzzELBzQeADQ37C/6v9SsGJULRW 8wvHb98NOCwEN/PF+oin5v9Dl42o/Yk0dDrbQyFqyhWg/RUtg0Km4zKUedoVOq3q4apV FbAnkxEU0NXs2u0DkudIYmnj6lw7rFsdfZrwMX5vXn9OY+nZ4GvpgrPCfFfLm7bjhDqF EELBOMJLsRgaHI0iXlLBrIYyDOVOII1oMRZXRNjYaTHOXxZ0o/ahmMVNcrMelfXOD1gr tWg38ic17UM9PpQAFPxnhxAPPNpMsQfGOFu72WDGY6O3UmywkdReJS7d18Y5wcxP2DEy xbrg== 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:autocrypt:openpgp:from:references:cc:to :subject; bh=NjjinZ4LAibK4/gIZ2/Lt4B00wMjEi4ZPSWZOujIYcU=; b=OuzO3ZeqxSBRSVhLSBjzVcpdpr+UPxtL5cNHHQ+GiFfOVXkcxoORYlBPU0kjqJ58tr k8zhHg29VKPa1E3GHemObeyN6SFu3q31QgJAM0QXacYcDcAmj8wTCkzc9lacX2wvOkfZ 07UV392T2ydjYjg0k6v4HRO56wF8b9LPKTIHjZJghzGu4t1Qs96xuy5q2LBmrGC/Qk7q Y3ZSljKgC2oszJuABZ/uS0RAbJCHnzRHmTLfofDyh7xqgkFeAVatgtM50EE/xvCalLc5 Avq6+TnWvK3v0QCHj1t8XhYv5bD6F82BFmKm0DvJdYypPbUPhj0v0tlvU8wxDqjU3azn aqAg== 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 o12si4087573pgn.145.2019.02.05.13.13.51; Tue, 05 Feb 2019 13:14:09 -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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728753AbfBEVMJ (ORCPT + 99 others); Tue, 5 Feb 2019 16:12:09 -0500 Received: from mx1.redhat.com ([209.132.183.28]:33180 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726114AbfBEVMI (ORCPT ); Tue, 5 Feb 2019 16:12:08 -0500 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 B32D93C2CDA; Tue, 5 Feb 2019 21:12:07 +0000 (UTC) Received: from llong.remote.csb (dhcp-17-91.bos.redhat.com [10.18.17.91]) by smtp.corp.redhat.com (Postfix) with ESMTP id 3B37F5C1B5; Tue, 5 Feb 2019 21:12:06 +0000 (UTC) Subject: Re: [PATCH 3/3] locking/qspinlock: Introduce starvation avoidance into CNA To: Alex Kogan , Peter Zijlstra Cc: linux@armlinux.org.uk, mingo@redhat.com, will.deacon@arm.com, arnd@arndb.de, linux-arch@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Steven Sistare , Daniel Jordan , dave.dice@oracle.com, Rahul Yadav , Thomas Gleixner References: <20190131030136.56999-1-alex.kogan@oracle.com> <20190131030136.56999-4-alex.kogan@oracle.com> <20190131100009.GB31534@hirez.programming.kicks-ass.net> <10672939-5C35-4DEF-AFDE-99E85E0F9C46@oracle.com> <20190205092256.GN17528@hirez.programming.kicks-ass.net> <4A727687-51F9-4FD0-9608-CDBAD6A6EF07@oracle.com> From: Waiman Long Openpgp: preference=signencrypt Autocrypt: addr=longman@redhat.com; prefer-encrypt=mutual; keydata= xsFNBFgsZGsBEAC3l/RVYISY3M0SznCZOv8aWc/bsAgif1H8h0WPDrHnwt1jfFTB26EzhRea XQKAJiZbjnTotxXq1JVaWxJcNJL7crruYeFdv7WUJqJzFgHnNM/upZuGsDIJHyqBHWK5X9ZO jRyfqV/i3Ll7VIZobcRLbTfEJgyLTAHn2Ipcpt8mRg2cck2sC9+RMi45Epweu7pKjfrF8JUY r71uif2ThpN8vGpn+FKbERFt4hW2dV/3awVckxxHXNrQYIB3I/G6mUdEZ9yrVrAfLw5M3fVU CRnC6fbroC6/ztD40lyTQWbCqGERVEwHFYYoxrcGa8AzMXN9CN7bleHmKZrGxDFWbg4877zX 0YaLRypme4K0ULbnNVRQcSZ9UalTvAzjpyWnlnXCLnFjzhV7qsjozloLTkZjyHimSc3yllH7 VvP/lGHnqUk7xDymgRHNNn0wWPuOpR97J/r7V1mSMZlni/FVTQTRu87aQRYu3nKhcNJ47TGY evz/U0ltaZEU41t7WGBnC7RlxYtdXziEn5fC8b1JfqiP0OJVQfdIMVIbEw1turVouTovUA39 Qqa6Pd1oYTw+Bdm1tkx7di73qB3x4pJoC8ZRfEmPqSpmu42sijWSBUgYJwszi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cj/USW4cAJ8b++9zE0/4Bv4iaY5bcsL+h7TqQBH Lk1eByJeVooUa/mqa2UdVJalc8B9NrAnLiyRsg72Nurwzvknv7anSgIkL+doXDaG21DgCYTD wGA5uquIgb8p3/ENgYpDPrsZ72CxVC2NEJjJwwnRBStjJOGQX4lV1uhN1XsZjBbRHdKF2W9g weim8xU= Organization: Red Hat Message-ID: <9ba407a6-8f16-876e-549a-d82176d2234e@redhat.com> Date: Tue, 5 Feb 2019 16:12:05 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: <4A727687-51F9-4FD0-9608-CDBAD6A6EF07@oracle.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit 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.29]); Tue, 05 Feb 2019 21:12:08 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 02/05/2019 04:07 PM, Alex Kogan wrote: >> Doing time analysis on a randomized algorithm isn't my idea of fun. >> >>> It seems that even today, qspinlock does not support RT_PREEMPT, given >>> that it uses per-CPU queue nodes. >> It does work with RT, commit: >> >> 7aa54be29765 ("locking/qspinlock, x86: Provide liveness guarantee") >> >> it a direct result of RT observing funnies with it. I've no idea why you >> think it would not work. > Just trying to get to the bottom of it — as of today, qspinlock explicitly assumes > no preemption while waiting for the lock. > > Here is what Waiman had to say about that in https://lwn.net/Articles/561775: > > "The idea behind this spinlock implementation is the fact that spinlocks > are acquired with preemption disabled. In other words, the process > will not be migrated to another CPU while it is trying to get a > spinlock.” > > This was back in 2013, but the code still uses per-CPU queue nodes, > and AFAICT, preemption will break things up. > > So what you are saying is that RT would be fine assuming no preemption in > the spinlock as long as it provides FIFO? Or there is some future code patch > that will take care of the “no preemption” assumption (but still assume FIFO)? > > Thanks, > — Alex Some of the critical sections protected by spinlocks may have execution times that are much longer than desired. That is why they are converted to rt-mutex in the RT kernel. There is another class of spinlocks called raw spinlocks. They are the same as regular spinlocks in non RT-kernel, but remain spinlocks with no preemption allowed in RT-kernel as sleeping locks can't be used in atomic context. This is where the replacement of the current qspinlock code by your NUMA-aware qspinlock may screw up the timing guarantee that can be provided by the RT-kernel. Cheers, Longman