Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp425340ybl; Thu, 23 Jan 2020 01:02:23 -0800 (PST) X-Google-Smtp-Source: APXvYqzVo4N36Iy/kX+0QwxCxNFQf6z4LnyaOo+X21lnhvL6Zrt8LGC8nADWA5AJZPuSNPAhnlXE X-Received: by 2002:aca:c08b:: with SMTP id q133mr9418367oif.46.1579770142933; Thu, 23 Jan 2020 01:02:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1579770142; cv=none; d=google.com; s=arc-20160816; b=am1ctDDzzPahWEt/Zh5GDC3DRtaRZjPmj7jrKcSU4lQBN9yxeuVORAQYx699IgCJvO lgUJj0bbA0xQk0IrkTHeqdf3DkQHyrtZKrSM9GODwKnA6yv7fdFIgE1YXyYnQd8FG20K KlwXi5MNGL+9ECmvCt/17I0ZEarzSWS039ZtH/ijBN9A/Kom27VFz+PvoRDphTQzwAav RUHkXFPEIK45b0HXhRdbC0HE4BTmoXfrHD28RPKWJF8oBcmfXem7mQ9v/FGk9tSV78Q2 1XrQ4XnYNA64AU7ykJucnwPvNH6au69Qt6O35G0ZJUDXOs7yE44XtVef3hswSOPdN4Dg yA2A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=ZO2+biof4EL4C/JTzti+vPwupIT1oX/9/8bYDrArCwQ=; b=AOrL6gkH8OVUnEkIwVdiNZnnIkkXu4lvmcoWkxiG0137wu9xG8suiEVBsppnyvJOkm lXwfxEteW0FIPi0Dc/RgOTogijDMYlr+0dIfiiuPrqtmlViZ44tmgMIJSDMN1LZODnKY ZFhcIeMrN7hxjrh11LI+EHcPrINUKO3Yu66sc+kR9fy5IUIO9SyYXWgiNr8PV7I1uKFs QUbVFhqXYORBo354K8D8otxDn9v/OB6eVyfE5yIXQRiJn3nRh7R52RsZEVTG/D5LFg1X IoSvG9qrUqmH3r/Gqlr812ojxKsJub92zmspw0wyf2CzsNTbvn8m1Y524jjxpVKVpJRk uZfQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=merlin.20170209 header.b=NOiIWQWR; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d1si793735oth.158.2020.01.23.01.02.10; Thu, 23 Jan 2020 01:02:22 -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; dkim=fail header.i=@infradead.org header.s=merlin.20170209 header.b=NOiIWQWR; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726442AbgAWJBM (ORCPT + 99 others); Thu, 23 Jan 2020 04:01:12 -0500 Received: from merlin.infradead.org ([205.233.59.134]:60352 "EHLO merlin.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725785AbgAWJBL (ORCPT ); Thu, 23 Jan 2020 04:01:11 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=merlin.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:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=ZO2+biof4EL4C/JTzti+vPwupIT1oX/9/8bYDrArCwQ=; b=NOiIWQWR4GnTdEVaJdQR3fftc 2cjR9yhlWoh9F+xe7DPXmdBijCqW1eXE8n5Fvs/tpQU5tjazIKyXL7ozieETUP8D7R2Dr52zTYZxr P/gUBWd02yvOYvrmHlHZAQBDFPQHdNFALsPqjjJj346oGnEuLC8ye6YplJxt91+stCTMCRXavRPnA HDLYjxi9LLgx4ck9ovojPNc9iu6QmqJDymrRomPMUDquZklmJPPX0yYRZRvACzenYgm41Rx1LaLgA PUF1NFgWuRJPJdX25fpYDxfHwEcyY85OTcn6+gGC1zLeO88BR9EM2Lhck1X3rsq9cPaXXeJRgd1XY 0j/R7gpyg==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=noisy.programming.kicks-ass.net) by merlin.infradead.org with esmtpsa (Exim 4.92.3 #3 (Red Hat Linux)) id 1iuYLx-0002NM-GD; Thu, 23 Jan 2020 09:00:41 +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 52282304121; Thu, 23 Jan 2020 09:58:58 +0100 (CET) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 3D19D20983FC2; Thu, 23 Jan 2020 10:00:38 +0100 (CET) Date: Thu, 23 Jan 2020 10:00:38 +0100 From: Peter Zijlstra To: Alex Kogan Cc: 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, rahul.x.yadav@oracle.com Subject: Re: [PATCH v7 3/5] locking/qspinlock: Introduce CNA into the slow path of qspinlock Message-ID: <20200123090038.GD14946@hirez.programming.kicks-ass.net> References: <20191125210709.10293-1-alex.kogan@oracle.com> <20191125210709.10293-4-alex.kogan@oracle.com> <20200121202919.GM11457@worktop.programming.kicks-ass.net> <20200122095127.GC14946@hirez.programming.kicks-ass.net> <20200122170456.GY14879@hirez.programming.kicks-ass.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200122170456.GY14879@hirez.programming.kicks-ass.net> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Jan 22, 2020 at 06:04:56PM +0100, Peter Zijlstra wrote: > +/* > + * cna_splice_head -- splice the entire secondary queue onto the head of the > + * primary queue. > + */ > +static cna_splice_head(struct qspinlock *lock, u32 val, > + struct mcs_spinlock *node, struct mcs_spinlock *next) > +{ > + struct mcs_spinlock *head_2nd, *tail_2nd; > + > + tail_2nd = decode_tail(node->locked); > + head_2nd = tail_2nd->next; > + > + if (lock) { That should be: if (!next) { > + u32 new = ((struct cna_node *)tail_2nd)->encoded_tail | _Q_LOCKED_VAL; > + if (!atomic_try_cmpxchg_relaxed(&lock->val, &val, new)) > + return NULL; > + > + /* > + * The moment we've linked the primary tail we can race with > + * the WRITE_ONCE(prev->next, node) store from new waiters. > + * That store must win. > + */ And that still is a shit comment; I'll go try again. > + cmpxchg_relaxed(&tail_2nd->next, head_2nd, next); > + } else { > + tail_2nd->next = next; > + } > + > + return head_2nd; > +}