Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp3512564pxf; Mon, 29 Mar 2021 04:28:43 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxJu0vwQakFyT4zEXTi/ZWJQTWqrOAFD/v2Ti4RfxWobgnsFBSzJI2PUn9PYwYiNb+WEoUM X-Received: by 2002:a05:6402:3487:: with SMTP id v7mr27901306edc.302.1617017323349; Mon, 29 Mar 2021 04:28:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1617017323; cv=none; d=google.com; s=arc-20160816; b=SJFAh+l7jI2Tpd2ofp80CkscEAbMfK0uRPYHUXxSE/1UqKuG51DuJWEbNdbaHFoh9C VP+Oix7II2ifF8zc6XnhIopxBe43IbLzW/7jOB6MvZ0fiyAFiT8HDR8J092b+8iKBQkn onrNlAeCFUs5gY1wrDmSXF+IXzpZlfcw5uvH4vZ77jc3kkIEZa1gqdE/l6EdpwEJOTbJ bKmdHsIkTAsq2U4Spz/Nh4leuhRQLl6XgI0FNz40bBLzvxYwkkPtUJtC5vHAk2f+pu76 tauvCUOqvPnTgmwccuU8k8hgPtHnK48STRNzEsY/R03/uRSvrmuIiuT/olPjAKpD/bIg c9CQ== 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=a6YbhyXk219havI+95QWm2VpeZkgxPnC4TWMCB0ywQ8=; b=CrzB0rljlgm0BnNmcuWieQUDmVvv4fpc+fMvLgY0u1LxAL2wXpExM/ALVQjdGNyqrU wo07k2TgTiBs4xq0UaWtIZx0hiQDeNJZ4+4o7iz+ELMqMQSSfbZN347dFbSNNTP+0jGf 3BdHX/htaQdZ8dCwLMGyMNe7qbEtu+kFEV4PGdBRFebBqx5HX8535dCkpYgIKglhSH/9 L23j9727yoR6jyHczu5vgQ+kC1zEvcQuclKcS7WkxXe3RLaxkXQCmVn+K4ECSMjfA8Nd cU1OykoVHFnPImD9N7Y7NGQnn1UUkRJQgNRv2sBskqhW5PFbVeyiNhs1ZQ+nTMTMknUl +UEA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=desiato.20200630 header.b=mQdBICEU; 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 h1si12806381edv.113.2021.03.29.04.28.21; Mon, 29 Mar 2021 04:28:43 -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=desiato.20200630 header.b=mQdBICEU; 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 S232696AbhC2L1N (ORCPT + 99 others); Mon, 29 Mar 2021 07:27:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33690 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232845AbhC2L0w (ORCPT ); Mon, 29 Mar 2021 07:26:52 -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 D98EAC061574; Mon, 29 Mar 2021 04:26:51 -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-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=a6YbhyXk219havI+95QWm2VpeZkgxPnC4TWMCB0ywQ8=; b=mQdBICEUN58k/ljPhRyt6zoRMA 3T4WAwN/7lXYa5OdeND6gLSdaBwm/7TwSRV5qEjFJDUNS/U/4BoXP/3w6GlIBllEeKDdtbd+qammj 4SLPg23xBZph6wQ5PrPmzAPdjepdLLnOYVcE7EEbUqLBUUu0cupzobheV5LcwFmi99j8AMSU4p3s0 earLgpf6YD6ZhU/R8V6XkEbnHQSRqvcfM4PDnkBqJff0TcU9t3QM5vVDSoSXoSHnQMwhLWiPNm09T MorsyyQo9KWhc+J1JUPbuEL3NLBmDsu3NxV32qpklapB3ZT3mg+CDqfDDfsOCCX5zwlM370R7gGay QbmjIP0w==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=noisy.programming.kicks-ass.net) by desiato.infradead.org with esmtpsa (Exim 4.94 #2 (Red Hat Linux)) id 1lQq2e-000cHI-4x; Mon, 29 Mar 2021 11:26:44 +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 857B83007CD; Mon, 29 Mar 2021 13:26:43 +0200 (CEST) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 6C168207539C5; Mon, 29 Mar 2021 13:26:43 +0200 (CEST) Date: Mon, 29 Mar 2021 13:26:43 +0200 From: Peter Zijlstra To: Guo Ren Cc: linux-riscv , Linux Kernel Mailing List , linux-csky@vger.kernel.org, linux-arch , 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: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Mar 29, 2021 at 07:19:29PM +0800, Guo Ren wrote: > On Mon, Mar 29, 2021 at 3:50 PM Peter Zijlstra wrote: > > > > 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. > I see, we've done two versions of this: > - Using cmpxchg codes from MIPS by Michael > - Re-write with assembly codes by Guo > > But using the full-word atomic xchg instructions implement xchg16 has > the semantic risk for atomic operations. What? -ENOPARSE > > Also, I really do think doing ticket locks first is a far more sensible > > step. > NACK by Anup Who's he when he's not sending NAKs ?