Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp2389108imu; Thu, 10 Jan 2019 13:19:39 -0800 (PST) X-Google-Smtp-Source: ALg8bN6w8GMOTSevCx2NLT0o3ghX/nQoR9BDD4xnLcWyfsuRg5YUMksHqHgFP07EbgqZk8YbiK6g X-Received: by 2002:a63:5c41:: with SMTP id n1mr10374885pgm.1.1547155179910; Thu, 10 Jan 2019 13:19:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1547155179; cv=none; d=google.com; s=arc-20160816; b=de/NuidY0geTkj9A/iBDUeZAag0KYpukNzYygAZj+6zXNYq5t+iXMEONwRjGF76++q 5NmccCehiIeKPpKRblYd2qBkLGwfLMnA8f7prWMwQQnu7pb5gMFwoeXS0tajf5soDWUm UwHhdCCBdIFfC2xgoiaVBMyCBVW6Swp4Ma5XugePYRgQ7mzvW7QA2WpelamyEbt9jCTA gyTe8pjsdWduV3yy0Lf2sBdB2p3go7aU+5IRXb9Z8+khXHSnXPCgyLJ1l/8SstvGWobY WiUReNwvN31sR239hnndFr4IE3nEt+9y66B0/6jJBJ85NyeqjBYlmNiqVZMuNYsVvwrz y2/Q== 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=34YxzfRCXCPtdMwxkCh+gXntgRrS8+hBKkRFHh9Txvk=; b=O/XMvAh84UHEt+N1+kVtwiRSX1i/SEGtQG5H4NYUgY/sZbj08w1nv/Vgw5Vh8kN8o1 DWAERMsYaGlUaJFdhK/khcYcss2FxCOD4buFoOuK63cYsqltXprcYPEfMJ6gQjUmv6UK cgpT0n4MoyqJA2ujt4y6Pj7Qoub44DoHpBod5aX8/uFofBlDPxUYnkteMuRQZnu6KDiD cOzSIMVBdA3hIO9/yTWqIHj88f0dWMP8U5Pod2ZbZkMN47eoiLNzefz3eSobT0EP9J8T G36e5N21l16q76mtuJMG8qa7omrbu6KoO6X1a/HBV12jXNB5BT8qSrUEB30sfiXGQKcX YKCg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=merlin.20170209 header.b=LnA16k8V; 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 v141si76723629pfc.260.2019.01.10.13.19.23; Thu, 10 Jan 2019 13:19:39 -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=LnA16k8V; 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 S1729973AbfAJUSw (ORCPT + 99 others); Thu, 10 Jan 2019 15:18:52 -0500 Received: from merlin.infradead.org ([205.233.59.134]:51358 "EHLO merlin.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729080AbfAJUSv (ORCPT ); Thu, 10 Jan 2019 15:18:51 -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=34YxzfRCXCPtdMwxkCh+gXntgRrS8+hBKkRFHh9Txvk=; b=LnA16k8VvU9IcMavRR62EatuB bDyxbIEgCTeQ2IIU0Lz1bVCi4z0AZNygaBQY/tO7UECZwIPbaJkHoxo7gW9A8czxC4gBl/EvjYTQS hLCnbWZYQcS5vpvHXVwA+mPAa/butOiTb05+CWfx2K2Lb7BBTmQw/EliokFwPLUBmAgYLagOGqI0s rSeVpz1iayfcGgUOuWdVjeKnbFJGrSM7ktpz3WNiySoJTwg8VaZsl5Z8BZCs7loouxwEbCuCMqAuU DaogQ1inoJHR5QAo+mr0fePyVVyKsTkG+hJXcXFpaOI+DAnMi/f/6eJsQaU0ePjlOkaKWeSgxrbJf HAqTmR2ig==; 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 1ghgmf-0006zn-6V; Thu, 10 Jan 2019 20:18:43 +0000 Received: by worktop.programming.kicks-ass.net (Postfix, from userid 1000) id 0BB519844AF; Thu, 10 Jan 2019 21:18:30 +0100 (CET) Date: Thu, 10 Jan 2019 21:18:29 +0100 From: Peter Zijlstra To: Dmitry Vyukov Cc: Florian Westphal , Anatol Pomozov , "Paul E. McKenney" , LKML Subject: Re: seqcount usage in xt_replace_table() Message-ID: <20190110201829.GI2861@worktop.programming.kicks-ass.net> References: <20190108223746.shuwx3ro7cgwz7hh@breakpoint.cc> <20190110124123.GA21224@hirez.programming.kicks-ass.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: 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 01:53:28PM +0100, Dmitry Vyukov wrote: > On Thu, Jan 10, 2019 at 1:41 PM Peter Zijlstra wrote: > > > > On Tue, Jan 08, 2019 at 11:37:46PM +0100, Florian Westphal wrote: > > > Anatol Pomozov wrote: > > > > Or maybe xt_replace_table() can be enhanced? When I hear that > > > > something waits until an event happens on all CPUs I think about > > > > wait_event() function. Would it be better for xt_replace_table() to > > > > introduce an atomic counter that is decremented by CPUs, and the main > > > > CPU waits until the counter gets zero? > > > > > > That would mean placing an additional atomic op into the > > > iptables evaluation path (ipt_do_table and friends). > > > > > > > For: > > > > /* > > * 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. > > Do we want WRITE_ONCE here then? The smp_store_release() already implies WRITE_ONCE().