Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp645468pxb; Thu, 21 Oct 2021 06:52:28 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyxR11GuQNtyN3X8S8CaogAUo06BHaI09ppyaiW93qE/ci6/vFM4+z/vi8fx2d5L2iHXwhX X-Received: by 2002:a17:906:254b:: with SMTP id j11mr7372109ejb.513.1634824348523; Thu, 21 Oct 2021 06:52:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1634824348; cv=none; d=google.com; s=arc-20160816; b=fVknKMnQcngBKe4CxowzeBBB3qO1jtknCk4V7qvzjwgbfzlkOnNypHEMLQansJD6Fs oqRJCcG/eVcF6s+5GA/NXZBzoS944vyb6uJLHAsL1qPU3K1HrXv+zQq08lHNIZqaWja2 nOsMS1Ej4qEcXd+ZQ0qoje6FpazSLp2C9cR2gGVMi4V3TJ86VEdZaDmcs8kqsQs1OsVt VmPpBRNXHlpQp24gyF0q1nBZsMGpeJrWj8PpLMRDZrZMRXWnGBZnpXopHudqGZ6/gIta EkjVyS6RlVNjFvkZm6BvBpAe19ZxwchFHGL96aWeQ7KVr+a/K4IPF3qj/i8wycXnhsnR CH+A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version; bh=3CsLUolkbkNZ5rYM41v6QLGxva6bkpxWtfD2trHs6Bc=; b=bGDbRxbzEgrHSXTe5fTxfYVj/gyMv9kh56ubk3rg/t/09rNrts9dnFMw5XrsMzYqNw FCWPct+hAvmYsy4wYp9q+RL8Q812WfBL5lS1bdqky94kAXul/vpQYr0jVn2Y+IeI1mGB +dFj4BY7Sfo0Vb+oPREv8MDMUb9fS33J2tTffvSOJBFDqJBc3hp4MTuFEYCoheJ+1IEc 2y91HtqXDqYW6SCwy4WZjLPeGoa/8RTWz/6BiEO9LDWhf5GmmS9PbsUroMxEzvnJaDfG gWbZMMoh3hHfNJ27sByZijWkfRup6UMJYeKuIXATJKNUqxlZI/pBqW1ZSCZl2VyMbvwB pIAw== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id dn15si1539118ejc.700.2021.10.21.06.52.03; Thu, 21 Oct 2021 06:52:28 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230436AbhJUNwZ (ORCPT + 99 others); Thu, 21 Oct 2021 09:52:25 -0400 Received: from mout.kundenserver.de ([212.227.17.24]:45341 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229878AbhJUNwY (ORCPT ); Thu, 21 Oct 2021 09:52:24 -0400 Received: from mail-wr1-f52.google.com ([209.85.221.52]) by mrelayeu.kundenserver.de (mreue107 [213.165.67.113]) with ESMTPSA (Nemesis) id 1MK3mS-1mPkh72WvG-00LZhi; Thu, 21 Oct 2021 15:50:07 +0200 Received: by mail-wr1-f52.google.com with SMTP id r18so1226479wrg.6; Thu, 21 Oct 2021 06:50:07 -0700 (PDT) X-Gm-Message-State: AOAM531XQ4qmZX/cdKyIo+x2yhiBXZAjDJHLwIev/Xn02DeZbZTtzNe1 iTlTEmqZOpad7CoNYsJJEtyxInXHMyDYZUi3bco= X-Received: by 2002:a05:6000:18c7:: with SMTP id w7mr7104304wrq.411.1634824207284; Thu, 21 Oct 2021 06:50:07 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Arnd Bergmann Date: Thu, 21 Oct 2021 15:49:51 +0200 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH] locking: Generic ticket lock To: Peter Zijlstra Cc: Will Deacon , Boqun Feng , Ingo Molnar , Waiman Long , Arnd Bergmann , linux-arch , Linux Kernel Mailing List , Guo Ren , Palmer Dabbelt , Anup Patel , linux-riscv , =?UTF-8?Q?Christoph_M=C3=BCllner?= , Stafford Horne Content-Type: text/plain; charset="UTF-8" X-Provags-ID: V03:K1:oz2/dP5J5bv0MZ5b5PpkbfR/AHPVkMMXoayFbA+g+9/TZYgDQim 599eBtzjZbI1PpL5vv/5JIMFEoDtxbIoRe5XU8Lt5U3hlp6hyeKhcLh86Ed07egMp66Gqs4 2zaLVEF8lr2Gk3I/7Bh+JroOclDoMQ3V6do9+wmUf3SxvgMQXVAcosHoCCJOdD0yk8bmVgj +M0300hmfe6u0Qfq93NMA== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1;V03:K0:8pKS50lWB3A=:AbKj+0rqm3eAX3LNHG38Hf PCiLyg8EA1uUI1n3wl5KfDu+b+ZdKxNM8v2ryQDCiitBWePuuG9ZOFIUrxC5CGn0PasAP+DGV mC0WkkBkMT4kC4XHlsBk/W1136WsQEnk6SMBtBQ2tNQG5oS2x3ymiEx6nhgZm7f3kpKz3v+gh uJXXou2bQzT3N0Kxr7uVcGktsw7k2IBB4HDltFLYG6pB8cQQZVO7YQxSR6PeBVF02chznZysj WheCPJbGX2pY+Rpp33iQJdQXwFadgvlObpC6054a9RltHw/t9Kl9HOILeZ9+dJCwbZ4xlWlAT LE+/D/5nKON5/qlUvtiGq/N3ZG7V9erIyuILvnNncoKvQ6tYSuJQSDJ8wFuw1sgOHMoNUf25H qIop0lKmZol1M6drDEsGzqhGDCYPMSAC29VyNf8yYf/2JVURNajOvIV1ukMC2A+9IEHli+2Ef /g2XE/XI4q7Ldo5M6FHkvNATxK7LrVMwNqCtC9eYulM7BLn+F3lXiBxUtJZ9FN/irVkHGosfD qvFfiD8uU0u3tXEJf6N8a2L3LjSloiBvTXGZ1QbIFupRHsNBVwZi4uy7jxxMCllwoi1FZ1U69 7jWtgQQ2nKsL6udnAg0Di0jlLq3IlrGz3UGOkz9zUvPQnH9KucX/62nN5/sNZAQBToHYHgQa+ +RGZak2WPRWmU/gXnXWgsj3rt6X8fAe/NjQK5XphEFxyaw7++bKsmT5JpUu2KPl44Yho= Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Oct 21, 2021 at 3:05 PM Peter Zijlstra wrote: > > Therefore provide ticket locks, which depend on a single atomic > operation (fetch_add) while still providing fairness. Nice! Aside from the qspinlock vs ticket-lock question, can you describe the tradeoffs between this generic ticket lock and a custom implementation in architecture code? Should we convert most architectures over to the generic code in the long run, or is there something they can usually do better with an inline asm based ticket lock or a trivial test-and-set? > Signed-off-by: Peter Zijlstra (Intel) > --- > include/asm-generic/qspinlock.h | 30 +++++++++ > include/asm-generic/ticket_lock_types.h | 11 +++ > include/asm-generic/ticket_lock.h | 97 ++++++++++++++++++++++++++++++++ > 3 files changed, 138 insertions(+) If anyone wants to use this for their architecture, feel free to add Acked-by: Arnd Bergmann to merge it through the respective architecture git tree. If there is more than one architecture that wants it right now, I could also take them all through the asm-generic tree. Arnd