Received: by 2002:a05:6358:700f:b0:131:369:b2a3 with SMTP id 15csp3271019rwo; Fri, 4 Aug 2023 02:04:25 -0700 (PDT) X-Google-Smtp-Source: AGHT+IG3yQPe78mikq8W9jXbRMQWPFmhrTye+nEqWoy1810CRXfUU7+apqKmXOuSsxXReD4LuN1b X-Received: by 2002:a17:902:b482:b0:1bc:ed3:5ac6 with SMTP id y2-20020a170902b48200b001bc0ed35ac6mr997416plr.63.1691139864980; Fri, 04 Aug 2023 02:04:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691139864; cv=none; d=google.com; s=arc-20160816; b=b+N3UKcasvS5IUsOn8AuOnB6TfX4bO18nV8lDL76LasNrfCVXpQNgHmyxO5wTKDIN4 3COC9KZE8Vg45TKZht3UzHQDLswgzETUkK3Ld9HXvRYS136Apx7ybrVtGQIC1M1R8NAH +G5+6gNBAlkBP8agk8ik7VNyFqpr3FnVDMr4hthiwkBenHg+ZKA971euz/VucfIWGIva RlCo+eucnSFvih80ShHHFSXO470I+DL3Cmh5VPhQMwRenHg0F3c2mIvO7kzDqsQtrixp hZMWBv+2hZ7gTcNiP86GhzXo7u9XoIicqSwDwwpRLq6nLqJS0tT3EwGC25HyL7uuxcvO xPTA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=kq8uP/RsR+7bhx2IAz3Uus90BPpjASz0BJ8o6o6e7xE=; fh=h0l4gfSBykqHr6xYzZC04AV1oMpywElI66wujMbsQ3w=; b=EhFfvbDKljzGCb1gt659AnvtV5sa2jS98aJ+nA5i+nPObCEk9HH7EqFOd9qgVb9X6F ANWHfU6lbHEIOIDuIoYIxq9GFPMpmPj9nyJPZDbWlTKqywsoCPlBZFZ92k110KNRzPp6 oB+c++s9TwojYAvTEk0zdpylSc2Q+ymc29GyXXlvLxXS6iHF2eCxBI9EKwcLYOzKqNQY n+ebDOre5Px32xJDlX1TNdtkyiyppDU0XrAKMVpVy7RoC+wEnpKWotU6fXmvCir3FeRD 0EWqm370dS5Aqj9R8ydGdexQltRVUJtJdePvW38c1/CjTICikFpSpg/KTFaVtcopzQIu 1chw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=desiato.20200630 header.b=SNGpYDKg; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id n9-20020a170902d2c900b001b569049666si1508297plc.617.2023.08.04.02.04.12; Fri, 04 Aug 2023 02:04:24 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=desiato.20200630 header.b=SNGpYDKg; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234531AbjHDI0Y (ORCPT + 99 others); Fri, 4 Aug 2023 04:26:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59248 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234580AbjHDI0Q (ORCPT ); Fri, 4 Aug 2023 04:26:16 -0400 Received: from desiato.infradead.org (desiato.infradead.org [IPv6:2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B4CF830C4; Fri, 4 Aug 2023 01:26:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=In-Reply-To:Content-Transfer-Encoding: Content-Type:MIME-Version:References:Message-ID:Subject:Cc:To:From:Date: Sender:Reply-To:Content-ID:Content-Description; bh=kq8uP/RsR+7bhx2IAz3Uus90BPpjASz0BJ8o6o6e7xE=; b=SNGpYDKg1GXgROFtj1qyUocW3P DzcvRBVkASTUm6mXfZdgI3BUnzEiHK/Q+AEKzO5zToLgvHE+HqjW9bvreC63GMRO1b7tjWmZvAiMz /CaRLE+JSwa/qCAhTdHSUHMn1hrJyVBiKWLdKAICfk8Qt2NMTrVOk8Z282jbj6iNUZosKzJbrGaj1 aOVheZ9mqZFSL0FPM44NEnhGTCy/6Kg5d8Xw8Hbxf3s1wWEP6x+rww4kA+Lq8QmiOITY5pkVHe4ol v555T12C38JxBrNGeAKdxqqvPWMDbTBAyOmXllytT/bGYC01oqcehuHJnI7EuMBraHqoov81MTB+/ KNIiPj3Q==; Received: from j130084.upc-j.chello.nl ([24.132.130.84] helo=noisy.programming.kicks-ass.net) by desiato.infradead.org with esmtpsa (Exim 4.96 #2 (Red Hat Linux)) id 1qRq7o-000EKt-1D; Fri, 04 Aug 2023 08:25:32 +0000 Received: from hirez.programming.kicks-ass.net (hirez.programming.kicks-ass.net [192.168.1.225]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (Client did not present a certificate) by noisy.programming.kicks-ass.net (Postfix) with ESMTPS id CA22F30007E; Fri, 4 Aug 2023 10:25:31 +0200 (CEST) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id A7AF42107C443; Fri, 4 Aug 2023 10:25:31 +0200 (CEST) Date: Fri, 4 Aug 2023 10:25:31 +0200 From: Peter Zijlstra To: Guo Ren Cc: Alex Kogan , linux@armlinux.org.uk, mingo@redhat.com, will.deacon@arm.com, arnd@arndb.de, longman@redhat.com, linux-arch@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, tglx@linutronix.de, bp@alien8.de, hpa@zytor.com, x86@kernel.org, guohanjun@huawei.com, jglauber@marvell.com, steven.sistare@oracle.com, daniel.m.jordan@oracle.com, dave.dice@oracle.com Subject: Re: [PATCH v15 3/6] locking/qspinlock: Introduce CNA into the slow path of qspinlock Message-ID: <20230804082531.GL212435@hirez.programming.kicks-ass.net> References: <20210514200743.3026725-1-alex.kogan@oracle.com> <20210514200743.3026725-4-alex.kogan@oracle.com> <20230803085004.GF212435@hirez.programming.kicks-ass.net> <20230803115610.GC214207@hirez.programming.kicks-ass.net> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_NONE,SPF_NONE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Aug 04, 2023 at 09:33:48AM +0800, Guo Ren wrote: > On Thu, Aug 3, 2023 at 7:57 PM Peter Zijlstra wrote: > > CNA should only show a benefit when there is strong inter-node > > contention, and in that case it is typically best to fix the kernel side > > locking. > > > > Hence the question as to what lock prompted you to look at this. > I met the long lock queue situation when the hardware gave an overly > aggressive store queue merge buffer delay mechanism. See: > https://lore.kernel.org/linux-riscv/20230802164701.192791-8-guoren@kernel.org/ *groan*, so you're using it to work around 'broken' hardware :-( Wouldn't that hardware have horrifically bad lock throughput anyway? Everybody would end up waiting on that store buffer delay. > This also let me consider improving the efficiency of the long lock > queue release. For example, if the queue is like this: > > (Node0 cpu0) -> (Node1 cpu64) -> (Node0 cpu1) -> (Node1 cpu65) -> > (Node0 cpu2) -> (Node1 cpu66) -> ... > > Then every mcs_unlock would cause a cross-NUMA transaction. But if we > could make the queue like this: See, this is where the ARM64 WFE would come in handy; I don't suppose RISC-V has anything like that? Also, by the time you have 6 waiters, I'd say the lock is terribly contended and you should look at improving the lockinh scheme.