Received: by 2002:a25:868d:0:0:0:0:0 with SMTP id z13csp2015715ybk; Mon, 11 May 2020 09:48:49 -0700 (PDT) X-Google-Smtp-Source: APiQypKR+wjpku4A7PZwQIH0s1OfLLbySbWcUMrcClFA1lKxUX2Y3ZOvUaejKHtgdLCWEvclCXQD X-Received: by 2002:a05:6402:602:: with SMTP id n2mr13974199edv.79.1589215729605; Mon, 11 May 2020 09:48:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1589215729; cv=none; d=google.com; s=arc-20160816; b=BbkB12pM4Dg552GCtgy2JsIRzosR0MkX09MlYndg3/U0AP3QHXGsyQEUX/RJbRMSfh eCUMPmLKWg17DkK23gUbuYCiMC/WD2r0QkNqm6d5jyfrq/PLR5FNPHa5EUDVTaQ71BxF LlLfw3MRjJ3DOBCv/MnkAmrLauIKEGipaU1CQ2aNAS0Mo1yVuYY0Y4f5qby1sF2TvGzJ EvS3zdMzPgWKZJPqQOoiF2dfTRr0p5JhyV+zwXqi7YanAnBiIAsq9Zr9C9henZaVAtOW +vE5ieHEHvNgSHPgr4gL5wSWJ8Lgc4Xj+sHMDCNR6Ew6b8ocRs/fbT+y4Um0LXgA90q/ tEKQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:to:in-reply-to:cc:references:message-id :date:subject:mime-version:from:content-transfer-encoding :dkim-signature; bh=xntjjopiDXJMJjTZuW8sCWxRZJFhujdIbxmRfLLYdZY=; b=OSleuTthQyLqxudsgMtoQ6ShveNxdQtqgm75o5IrDH5IYz+WO8DgCxcqkmdV8Q9tLy dxtRG5od7WKdKSLfc3p9u6C1eMCBz4EXtc5aah/EjRpGsUBpJqKmAmlu/VD8ZwkRz8Xh y6n+iRz1H6ynlgXSg976M8juHxXnQO3tF3c3aRQ/qfBk3GSPMnUdnJaORl/7kWqPA6lB BSlFla+KXtQoxGRNhz4S+lgEYvXfZN2TGTrDbgvYz177hrNSmyiZbZdo0oq6y8+hHwC3 yVc2Ff/pepwmzM5cVud0lok6SvN2i8+hiJx5ifUCdApHg5JPCjRziHtmJK7R81J8p32J 3Uvw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@lca.pw header.s=google header.b=R3+YB1cN; 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 dp17si7884387ejc.317.2020.05.11.09.48.24; Mon, 11 May 2020 09:48:49 -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=@lca.pw header.s=google header.b=R3+YB1cN; 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 S1730696AbgEKQoa (ORCPT + 99 others); Mon, 11 May 2020 12:44:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60588 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729463AbgEKQoa (ORCPT ); Mon, 11 May 2020 12:44:30 -0400 Received: from mail-qt1-x82d.google.com (mail-qt1-x82d.google.com [IPv6:2607:f8b0:4864:20::82d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E574FC061A0C for ; Mon, 11 May 2020 09:44:28 -0700 (PDT) Received: by mail-qt1-x82d.google.com with SMTP id c24so2060517qtw.7 for ; Mon, 11 May 2020 09:44:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=lca.pw; s=google; h=content-transfer-encoding:from:mime-version:subject:date:message-id :references:cc:in-reply-to:to; bh=xntjjopiDXJMJjTZuW8sCWxRZJFhujdIbxmRfLLYdZY=; b=R3+YB1cN+Nl50Z+4XOutaE6RbDh3I1hicUpoZVR51l4aEOCM55H45TC4bPYOTm86ZX b5IsheVHjSMZNIf2kvZQ9SkD765IG7dWLxgB2Xa2S4uKRpRYgj4jAhFnkfQ/X86TXgov 8Zm0EhlJV89EFD60gyf1+P3Hiu/mSzKbL+v6+gG/+nUUx02RDGHny8HkGdhw5mIilCfo 00vGZf5T/uZ8qGGCRkRoLRy4XYLKFNmhC44TYmARKWmwJFWKdfdabXtg/hUvPqAbyhSl YyJPg5H5gdrJ7XWqJR9Fx1f+sMQNrpVkEVxsGrSEPMuuwmTokiqePoPoa4hSDDpr4uPh HWMg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:content-transfer-encoding:from:mime-version :subject:date:message-id:references:cc:in-reply-to:to; bh=xntjjopiDXJMJjTZuW8sCWxRZJFhujdIbxmRfLLYdZY=; b=fQkd/n2WPcSEjmQ7XkimKFagLISHjIDsY3pJ6VK2d1iHSZPAP3uh5plul2UVphMzL4 sSLjNmVpp0FYpfEy/xae87BB1mE9z1S4iwrFkYA2UDDhuq4kjZ6Haq1du0dRkkG5ZeH6 9bZWbokYgWf0xEx3zR3DBDT+uCwQUvQ4zqKqcZtmc2NmnJ2OIx739V/ABOllbfxlxQBc YW2M3ZvYpKaZTMtySNCVVbRR+e/X559i92/sYs6UkCwfhEeoz3vT49UGmk9PbkjEdyfd zP3htnxs8A4CKnqKQU3tFKB6kWZTVX7m6KPLCJecCPrEM2dw7DDnby4BSIz+CHxIRkTa xUGA== X-Gm-Message-State: AGi0PubFHCBbY6Dm1H70XZlBTO7S1W54oXaP7H6KwC1mMol9ja2Jilv4 aIiSFzzBf+R+7UL0qHM+7wvOyQ== X-Received: by 2002:ac8:4447:: with SMTP id m7mr17283994qtn.372.1589215467856; Mon, 11 May 2020 09:44:27 -0700 (PDT) Received: from [192.168.1.183] (pool-71-184-117-43.bstnma.fios.verizon.net. [71.184.117.43]) by smtp.gmail.com with ESMTPSA id s30sm7749259qtd.34.2020.05.11.09.44.27 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 11 May 2020 09:44:27 -0700 (PDT) Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable From: Qian Cai Mime-Version: 1.0 (1.0) Subject: Re: [PATCH -next v2] locking/osq_lock: annotate a data race in osq_lock Date: Mon, 11 May 2020 12:44:26 -0400 Message-Id: References: <20200511155812.GB22270@willie-the-truck> Cc: "Paul E. McKenney" , Elver Marco , LKML , Ingo Molnar , "Peter Zijlstra (Intel)" In-Reply-To: <20200511155812.GB22270@willie-the-truck> To: Will Deacon X-Mailer: iPhone Mail (17D50) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > On May 11, 2020, at 11:58 AM, Will Deacon wrote: >=20 > I'm fine with the data_race() placement, but I don't find the comment > very helpful. We assign the result of a READ_ONCE() to 'prev' in the > loop, so I don't think that the cpu_relax() is really relevant. >=20 > The reason we don't need READ_ONCE() here is because if we race with > the writer then either we'll go round the loop again after accidentally > thinking prev->next !=3D node, or we'll erroneously attempt the cmpxchg() > because we thought they were equal and that will fail. >=20 > Make sense? I think the significant concern from the previous reviews was if compilers c= ould prove that prev->next =3D=3D node was always true because it had no kno= wledge of the concurrency, and then took out the whole if statement away res= ulting in an infinite loop. The comment tried to explain that the cpu_relax() would save us from the inf= inite loop in theory here.=