Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp1040808ybl; Fri, 31 Jan 2020 12:53:33 -0800 (PST) X-Google-Smtp-Source: APXvYqxEneGyzILgNjTaOIiZWlz6y16AMz178RLJkOLQ/E2dHDFAbqEMebotLevhRw2111gP3qgs X-Received: by 2002:aca:45c1:: with SMTP id s184mr7903963oia.158.1580504013611; Fri, 31 Jan 2020 12:53:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1580504013; cv=none; d=google.com; s=arc-20160816; b=sRrXcXoXNtpC2zwmAC5+3eCO+4QdzVyjZM0kZD8svSboUfkye53SGILIAOWn76YuK+ YsdpWrnchyy/c05uwtdWh4VAe2Muwzjr1Q8nZ72r5KMGgA2LqNNLUhthzWGC6iARQ/uj tRFxsof1Qf5eNqUXanuIRHs3MGzCE05surCnna0HM+26MCUflyZs81UTLlwcwoBVOMuw vXWdSsXxbfhD4B9DGzHI8cSp30KHYz8PSEn2LVX4Gcoh27d+RFjo0hKdTyFOhNHmYVZG AvJwAznLidEyQuACBogXHtHnlAZD/4nIM9I18UU3mRxQqbAxHFwCcw2xm8aYJYfxUHLe VW9g== 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:reply-to:message-id :subject:cc:to:from:date:dkim-signature; bh=1q6c4jBJcZrnBFOfLrf+eQYRwk203ZhtceTvXz8/aNA=; b=KD2gLMwJ2jOX4HLPGZzjl/8BjbVyk6mK7bf8wczcup4lj59n7aBc7qPhmmy5KBv+12 YvdQkszxgNSUPxiPWEo5fhyGik8KnhUU9YwbIGs0iI+YGXXRRts+UrvEvY6TIL4hvc8Y BuLBBZFO2njYXYu09kkzw7s50Kqy/8gHO26LPevziHhnSPr2L9UpYfiQ+mtLXeKvgTbV vECskIdKwtSv5BpfT/dYdJWjlOUZWpyG08SUtx7HRj/gRUkxy+FznIH038baXyaZveBy Kprq9tiEGsz396DGOFtDqrTX3qe3M2xqMkBkTMZNvE6EKObD1RL3fcnm9qxesLSo6lx/ dQEw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=L63j83fr; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j2si5201600otr.255.2020.01.31.12.53.22; Fri, 31 Jan 2020 12:53:33 -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=pass header.i=@kernel.org header.s=default header.b=L63j83fr; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726488AbgAaUwG (ORCPT + 99 others); Fri, 31 Jan 2020 15:52:06 -0500 Received: from mail.kernel.org ([198.145.29.99]:42374 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726102AbgAaUwG (ORCPT ); Fri, 31 Jan 2020 15:52:06 -0500 Received: from paulmck-ThinkPad-P72.home (unknown [199.201.64.141]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 3C28F214D8; Fri, 31 Jan 2020 20:52:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1580503925; bh=ggViF55VCZoAIomrRrDA8sGhLP1UgxQv53jNUU3zMSU=; h=Date:From:To:Cc:Subject:Reply-To:References:In-Reply-To:From; b=L63j83frlXKKBxND2q4Oo+yOp8q55JTTp2QcM1SLfnUxRiuxd4ui0ZRIjv8+6anoT v4zlep3CWaXrvLmtWAesgQhTXTL3kbr+Yl4v40UId5X09E19tAzZyT2BE3T7QB0eTc J1JTV+S9pjYQP4TD8eIGTaHNrpJgrVhap1mYMvHc= Received: by paulmck-ThinkPad-P72.home (Postfix, from userid 1000) id A682E3522722; Fri, 31 Jan 2020 12:52:04 -0800 (PST) Date: Fri, 31 Jan 2020 12:52:04 -0800 From: "Paul E. McKenney" To: Thomas Gleixner Cc: Eric Dumazet , Will Deacon , the arch/x86 maintainers , LKML , Peter Zijlstra Subject: Re: Confused about hlist_unhashed_lockless() Message-ID: <20200131205204.GT2935@paulmck-ThinkPad-P72> Reply-To: paulmck@kernel.org References: <20200131164308.GA5175@willie-the-truck> <20200131165718.GA5517@willie-the-truck> <20200131172058.GB5517@willie-the-truck> <87blqj4ddg.fsf@nanos.tec.linutronix.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <87blqj4ddg.fsf@nanos.tec.linutronix.de> User-Agent: Mutt/1.9.4 (2018-02-28) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Jan 31, 2020 at 08:47:23PM +0100, Thomas Gleixner wrote: > Eric Dumazet writes: > > On Fri, Jan 31, 2020 at 9:21 AM Will Deacon wrote: > >> Without serialisation, timer_pending() as currently implemented does > >> not reliably tell you whether the timer is in the hlist. Is that not a > >> problem? > > > > No it is not a problem. > > Even if we would take the base lock then this is just a snapshot, which > can be wrong at the moment the lock is dropped. So why bother? The risk of leaving it as-is or of using data_race() is that if it is checked multiple times, the compiler might use the old value. Yes, we could say that things like barrier() should be used in those cases, but READ_ONCE() has the advantage of making it so that no one has to worry about those cases. Thanx, Paul