Received: by 10.223.176.5 with SMTP id f5csp1312368wra; Wed, 31 Jan 2018 04:40:32 -0800 (PST) X-Google-Smtp-Source: AH8x225nd+NysVmKO10jcSuTfONsWf5rWaZz2rNKmPw6cIwFEl8kwG9xrGLSl4BPrCT+UD0h+Dth X-Received: by 2002:a17:902:7c97:: with SMTP id y23-v6mr28595688pll.439.1517402432310; Wed, 31 Jan 2018 04:40:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517402432; cv=none; d=google.com; s=arc-20160816; b=Rsq7LBzhjaBlQ/6OLxtffRdP7jjmC3mFu6oUV0iFyHL8EY13FV2uDI4j+mmWyLyvm7 wUhQniAx2AREIcQu85OWUQfp/ajNc1aiFRRqAolQ/5hqD83yXqgtKEXw5CK7ywp65bfR lp/+2KHvzHeh4qw5aq315fUjtiWHU39KZiBJC1WoA+ge5nXpibXM6t1Kk8M6pfaxRDDv /sbZmcllpW0Kb4LeTBCpaqi2vu7hcOpKEy09ilU/Vo2C8FZr/unxrby9TzjWgexPyPQ1 CQoE08ifAjax61JKDpXHbFfvjuexZIv2MgiLjfwLmUlPIaJ4YQNHj0rr77mUuLPLmWLZ dviQ== 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:arc-authentication-results; bh=0apiy3eoWtMuul6z2SCJSoIxadnmaxIEh3JzP1kbjhs=; b=vH8yl8y1Cda7fRXNSI1vJDRgOBQ/qOizj2P+fbkYyNQJNvRv+OTeHt2eCmZDAbSkGW HNCQmsdWqQnisgXG99Zq1PGn+kD2mtOuh5Dsi8N3bYyZ3oniNMyKYmWKFNwNXXWEOJCK EGG/+w7tNIFFbydco6VZzAL5NDLw6VktaXCperfUWbSUWAnaRrzsXtDDYR76lAga+lXL N7yluVfQwbz83CfU+MzkUCbHSTgWUhisJPRICKwIBW+iq9D1c+rYjWYBtRXcw3MTzpBL lLRbd9quTKnFFmf11c4lqWVomxnQVR/0Ajx5P2deFbaS15FmuBCESv3P+FR1FHUMmL2Z EmZQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=merlin.20170209 header.b=ABKE75tB; 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 i12-v6si13945691plk.139.2018.01.31.04.40.16; Wed, 31 Jan 2018 04:40:32 -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=ABKE75tB; 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 S1752658AbeAaMjs (ORCPT + 99 others); Wed, 31 Jan 2018 07:39:48 -0500 Received: from merlin.infradead.org ([205.233.59.134]:45094 "EHLO merlin.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751700AbeAaMjI (ORCPT ); Wed, 31 Jan 2018 07:39:08 -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=0apiy3eoWtMuul6z2SCJSoIxadnmaxIEh3JzP1kbjhs=; b=ABKE75tB1trbWWp+OvM7wXa67 LAmQuPsZVLtbApCm9DhjBfBcBCPo4vHlREn00XezSRRITZIZzWC5aR4P4934IZ9MNWjbSw20xhXR9 sRKlnXe1wF6xcY5iCOGxcxC+CcndUyTV3fCNA1+JVC+IMgW5IbPexNzAA26kbIHReMw5HoZCOK3QW hNSUHeWIEz4LIeqHwkoS6GNUTIsY+U2UoP5CN1sCB8197QjLNmqhRMnoUsQyntdEBE1WrKtneIyYf 3p8bwVXZuhbEUJMPrfcr7/OuwqGFvdD2Liy7IKXPvkjqQ4FYkUrrWemXsUAZ7ASlb1QUdNJHkk2qN i4uzrqCcQ==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=hirez.programming.kicks-ass.net) by merlin.infradead.org with esmtpsa (Exim 4.89 #1 (Red Hat Linux)) id 1egrfJ-0006Yw-4g; Wed, 31 Jan 2018 12:39:01 +0000 Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id CD4652029F9F9; Wed, 31 Jan 2018 13:38:59 +0100 (CET) Date: Wed, 31 Jan 2018 13:38:59 +0100 From: Peter Zijlstra To: Will Deacon Cc: linux-kernel@vger.kernel.org, Ingo Molnar Subject: Re: [PATCH] locking/qspinlock: Ensure node is initialised before updating prev->next Message-ID: <20180131123859.GQ2269@hirez.programming.kicks-ass.net> References: <1517401246-2750-1-git-send-email-will.deacon@arm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1517401246-2750-1-git-send-email-will.deacon@arm.com> User-Agent: Mutt/1.9.2 (2017-12-15) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Jan 31, 2018 at 12:20:46PM +0000, Will Deacon wrote: > diff --git a/kernel/locking/qspinlock.c b/kernel/locking/qspinlock.c > index 294294c71ba4..1ebbc366a31d 100644 > --- a/kernel/locking/qspinlock.c > +++ b/kernel/locking/qspinlock.c > @@ -408,16 +408,15 @@ void queued_spin_lock_slowpath(struct qspinlock *lock, u32 val) > */ > if (old & _Q_TAIL_MASK) { > prev = decode_tail(old); > + > /* > - * The above xchg_tail() is also a load of @lock which generates, > - * through decode_tail(), a pointer. > - * > - * The address dependency matches the RELEASE of xchg_tail() > - * such that the access to @prev must happen after. > + * We must ensure that the stores to @node are observed before > + * the write to prev->next. The address dependency on xchg_tail > + * is not sufficient to ensure this because the read component > + * of xchg_tail is unordered with respect to the initialisation > + * of node. > */ > - smp_read_barrier_depends(); Right, except you're patching old code here, please try again on a tree that includes commit: 548095dea63f ("locking: Remove smp_read_barrier_depends() from queued_spin_lock_slowpath()") > - > - WRITE_ONCE(prev->next, node); > + smp_store_release(prev->next, node); > > pv_wait_node(node, prev); > arch_mcs_spin_lock_contended(&node->locked); > -- > 2.1.4 >