Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp3400596pxf; Mon, 29 Mar 2021 00:52:23 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxUzn7MVnOgF6oaeEREUGmG8mshHqFzCsSyF5zNiWZkxIsuwD6gYeXFznre4Ff75cP8XzzE X-Received: by 2002:a17:906:bcc7:: with SMTP id lw7mr27671477ejb.209.1617004342888; Mon, 29 Mar 2021 00:52:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1617004342; cv=none; d=google.com; s=arc-20160816; b=NXXTcFAk0XEee8gQeDrgbVlGIi2/6W7osdDA+1GUvygVeG/JtYIZ9B3a5nAsJYudYT K/9IJUXxJvuzG7dZb2dNJtr1Hh8t64IHXOWR1MtEucTex/SOHpme8JWqZeuwRkcp7SF1 Itj9TBRSFVUDE44H/2zmGQzcD5YXBJa0OepXKJIMG/1ouqUg/aTxzEjvQG5FcfCByRCc 9UUBcPkI/EBPqMJib7gYTIgrRz3NYwlKfjdqag4Iy1YS6E9rhrXAWaVRD/EqA/w64E5E L6nZSFBPG77zKuaj/OOcfxrF5vEEmutAgdGlA9UxLwBb4lyyeda04YflRNOjJXQ/jvzB +E3A== 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-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=RmtQjdY4jd7gdJlUZ3DW9jMcByENp8YMhL3jjISCf78=; b=ZTTddoI5NCxQieY+xqWYKk28NcDrWP//ZAO5IQTDggR+QqKEhIj0koexmvZBaxzsyA 2j/uawpxfsOHRV7GEjc4amx3nMywz2L2N4FsfXLc8BLckFdn4DIPELY8g2Y0KSsPcTsH PTz3KsI0Q3/zVQ4Ll/9AnnHFOxNhnes3K5QQHU+nzlOyabH+L7zRL6JdrTq7/fUpFW8I zgSO2vMRQTULun4+HV0Fb10kGtuVJRCPF3nqQO1saGKONdS0Hv2w+zA/0s9cZJvSGD31 47DcGwyaP8oMjFEA4gJE0qgoOJRGtQMzjmhvq0QfTBpnHWL6PnijNQ0n8rU2XfP/b0+g zzpw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=nnsLTgcv; 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 sa4si12981309ejb.662.2021.03.29.00.51.59; Mon, 29 Mar 2021 00:52:22 -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; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=nnsLTgcv; 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 S231468AbhC2HvH (ORCPT + 99 others); Mon, 29 Mar 2021 03:51:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41602 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230516AbhC2Huv (ORCPT ); Mon, 29 Mar 2021 03:50:51 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9725BC061574; Mon, 29 Mar 2021 00:50:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=RmtQjdY4jd7gdJlUZ3DW9jMcByENp8YMhL3jjISCf78=; b=nnsLTgcvgCRg3B8Fc0hgEyHVPa C3nz4ZoUQzUhylNi2HcH7gsoEOw0NP02VuD30ri51IFNz7TdHeT8fI856Z12noRCm6mDLZxDe54GG FcuZUNJLbDaeFENhAjbP8BsnJcQxz0D3Ue2kBv545ZemDljZy0HQZtA+o4hJkFkYyfG0vnwykvY0h UxSf6d+v1U+TfhvAocF63PQOzKYT4rXagudr+KYPJZSJCheIDn2HB6KLENrteYmJE5xFcHxximPDJ 7YXs4t4aupq1wyuYM18uogTbiu005muh7DV+DWqh4GYKLgujOwVzYt4diS5ecQ/MkhQ7EDTR8mdUF 6CmPI6cQ==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=noisy.programming.kicks-ass.net) by casper.infradead.org with esmtpsa (Exim 4.94 #2 (Red Hat Linux)) id 1lQmew-001CUv-Cc; Mon, 29 Mar 2021 07:50:06 +0000 Received: from hirez.programming.kicks-ass.net (hirez.programming.kicks-ass.net [192.168.1.225]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by noisy.programming.kicks-ass.net (Postfix) with ESMTPS id 836C5305CC3; Mon, 29 Mar 2021 09:50:01 +0200 (CEST) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 62B48207189A5; Mon, 29 Mar 2021 09:50:01 +0200 (CEST) Date: Mon, 29 Mar 2021 09:50:01 +0200 From: Peter Zijlstra To: guoren@kernel.org Cc: linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org, linux-csky@vger.kernel.org, linux-arch@vger.kernel.org, Guo Ren , Will Deacon , Ingo Molnar , Waiman Long , Arnd Bergmann , Anup Patel Subject: Re: [PATCH v4 3/4] locking/qspinlock: Add ARCH_USE_QUEUED_SPINLOCKS_XCHG32 Message-ID: References: <1616868399-82848-1-git-send-email-guoren@kernel.org> <1616868399-82848-4-git-send-email-guoren@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1616868399-82848-4-git-send-email-guoren@kernel.org> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, Mar 27, 2021 at 06:06:38PM +0000, guoren@kernel.org wrote: > From: Guo Ren > > Some architectures don't have sub-word swap atomic instruction, > they only have the full word's one. > > The sub-word swap only improve the performance when: > NR_CPUS < 16K > * 0- 7: locked byte > * 8: pending > * 9-15: not used > * 16-17: tail index > * 18-31: tail cpu (+1) > > The 9-15 bits are wasted to use xchg16 in xchg_tail. > > Please let architecture select xchg16/xchg32 to implement > xchg_tail. So I really don't like this, this pushes complexity into the generic code for something that's really not needed. Lots of RISC already implement sub-word atomics using word ll/sc. Obviously they're not sharing code like they should be :/ See for example arch/mips/kernel/cmpxchg.c. Also, I really do think doing ticket locks first is a far more sensible step.