Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp2388540imu; Thu, 10 Jan 2019 13:18:57 -0800 (PST) X-Google-Smtp-Source: ALg8bN6KrfKyPlWthhGT4NE8Dd6LIySc9/1S9o+zhf8I9e6MiLHBXKNazF6jyxgfT/DvVB35dq0y X-Received: by 2002:a17:902:43e4:: with SMTP id j91mr1405233pld.147.1547155137209; Thu, 10 Jan 2019 13:18:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1547155137; cv=none; d=google.com; s=arc-20160816; b=TLp9CMn4zNr8z2+fUURVV7BQPyh4DNtnKC/tM6fCx7V6XB5nLk1QM4ChpOvywByU5h PBvmXb4jw6VWkiIOAPzetJJ4MENSl/SrCEggwgT2CMiRXkAzuYCBMBcdaj+AWQCKtvEw qA0XPSCwky0uZ4dMErPMCoT0SRwL8ElE/gGU1S3Op3wMIbOly3d+SCB8TFge7uH6HCWK IlzMD76C0gGEdS7q65EqIymawvbBuyCqo3SxEZWNjGYsnSRjLt18T9ATn8MtfauxuSJY elufuMhb1x44JvS5cx2jhqVfTYKOQ+yGHCXWO01ohEtQl/8DPU0KAuFEIKeI03xIobhc TXiA== 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=3Uck0g1nu/MAhAmoxyTpF+5QSanjNqtPY8ZILNK+8o0=; b=mpgMUXM8LdzlYLWUCBefB1ThI7NyYo6z+Bd0UZ6D+/FOr4oNUwaWt5ftZ7XusfWDzs T7wS50Yhss42dmlwF4Q6NBxHcI0PL1E26pOyKTnClRZSJGplvNbgDbIVkuiaY8WCjxx5 dFZihx9CT8swa+BtqcmH7AnaqP8tj91a23Pu9zvzcS0VRUMaN+vls9BNxLr27kWNlKq7 EUKW9W0VsSyl/3LOO3xFW0itRGsihRuRppZL2KqMiI/pipghW7uxaryeVh9CRFf9PFMY evLOFkBIqruR9Fbp161ZaxY5i9NJjxyyc7poCkuxMStuwsVM7jH51eb+NHY/GoEByw6n OWzw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=merlin.20170209 header.b=GzonvghC; 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 s8si21844333pgm.508.2019.01.10.13.18.42; Thu, 10 Jan 2019 13:18:57 -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=GzonvghC; 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 S1729636AbfAJUUf (ORCPT + 99 others); Thu, 10 Jan 2019 15:20:35 -0500 Received: from merlin.infradead.org ([205.233.59.134]:51378 "EHLO merlin.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729232AbfAJUUf (ORCPT ); Thu, 10 Jan 2019 15:20:35 -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=3Uck0g1nu/MAhAmoxyTpF+5QSanjNqtPY8ZILNK+8o0=; b=GzonvghCFo7WEr3DO/ZL6C84r yWD0TH/frRosT+n975ZUNinN4VEcDPstMq+TkIClJS0i8UMWg6oQ1Po1VTa9eUE0rLUoGR8iyX7N1 uSa8g/IT8ian5jneVPr9bFf2U7xvCJPNB9Iudb0Z+uAfBOaU0bC5Cjn/F2GdL5itnhkBAb2Lscd4V ue6ZtLKlewKUE6FMLtatXkhU41g4r62/7ShAbx85tuxk6x4yxNmb9bUdBje8NXfMHZlTSgDm/UHmY 4bHTZEZm/IO1XBQiuQe0UjFBb9XAHTMPT5+jc5XFxpoBYOUgJuT6fQTE58ec/vB1une5MRRtEA6Wq lJmjEquVg==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=worktop.programming.kicks-ass.net) by merlin.infradead.org with esmtpsa (Exim 4.90_1 #2 (Red Hat Linux)) id 1ghgoZ-00070M-J8; Thu, 10 Jan 2019 20:20:31 +0000 Received: by worktop.programming.kicks-ass.net (Postfix, from userid 1000) id 042E29844AF; Thu, 10 Jan 2019 21:20:29 +0100 (CET) Date: Thu, 10 Jan 2019 21:20:28 +0100 From: Peter Zijlstra To: Florian Westphal Cc: Anatol Pomozov , Dmitry Vyukov , paulmck@linux.ibm.com, LKML Subject: Re: seqcount usage in xt_replace_table() Message-ID: <20190110202028.GJ2861@worktop.programming.kicks-ass.net> References: <20190108223746.shuwx3ro7cgwz7hh@breakpoint.cc> <20190110124123.GA21224@hirez.programming.kicks-ass.net> <20190110144812.mkbokbj2iyryj6lv@breakpoint.cc> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190110144812.mkbokbj2iyryj6lv@breakpoint.cc> 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 Thu, Jan 10, 2019 at 03:48:12PM +0100, Florian Westphal wrote: > Peter Zijlstra wrote: > > /* > > * Ensure contents of newinfo are visible before assigning to > > * private. > > */ > > smp_wmb(); > > table->private = newinfo; > > > > we have: > > > > smp_store_release(&table->private, newinfo); > > > > But what store does that second smp_wmb() order against? The comment: > > > > /* make sure all cpus see new ->private value */ > > smp_wmb(); > > > > makes no sense what so ever, no smp_*() barrier can provide such > > guarantees. > > IIRC I added this at the request of a reviewer of an earlier iteration > of that patch. > > IIRC the concern was that compiler/hw could re-order > > smb_wmb(); > table->private = newinfo; > /* wait until all cpus are done with old table */ > > into: > > smb_wmb(); > /* wait until all cpus are done with old table */ > ... > table->private = newinfo; > > and that (obviously) makes the wait-loop useless. The thing is, the 'wait for all cpus' thing is pure loads, not stores, so smp_wmb() is a complete NOP there. If you want to ensure those loads happen after that store (which does indeed seem like a sensible thing), you're going to have to use smp_mb().