Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp1879025imu; Thu, 10 Jan 2019 04:42:51 -0800 (PST) X-Google-Smtp-Source: ALg8bN5DY+KRHoNnj313NMTb0Ssnc8sRWuICTdrUah96IofwG1+XnVu+QcsRIA2NEv/cCLMPAfiV X-Received: by 2002:a17:902:b406:: with SMTP id x6mr9759931plr.329.1547124171203; Thu, 10 Jan 2019 04:42:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1547124171; cv=none; d=google.com; s=arc-20160816; b=Vy+47bakKrkPF00bP9eYIwLqXATE0m+9usliHVgp0adfa6aZPc8G+aUu5eTzHvg7V7 kOswH1o0jFH3n/na6KXRIUQcL+1BBzIhf8f7GM/7J3HS+HX2Lt34cvs414/uB24T5mB+ WgeTWXpfjONW87HAHBW6mNwALsFo49UCUp7QmSvHXNnnBlpSE0yrP4ofhAsfLlUlI3mS daxfcSpZiKGp2go3NmZPXKNj9IxPMyxbuKzmwZL3tAygbMZl168oJqfTu4TRujp4VA6m wjrO154xzjVfJOdRHn4KgIup9H2P96K/yFpUc1MpFTx27ftCu04X9EQc1msbsiqBbizs l9Hg== 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=xCx8b08LW7Cc4m9Iovv8U6+26LBBjqnoySmyNAnN9Bg=; b=JOvfJwMBmN24GWeKI3lD8QT91e5kMS4WZcjCT6q9TlH4qZ60hk27oqVzYVecWDkeRM iwqNLsjiEbEspZ7CK4q6CJMZzmPBaql5CpRMbZP2q+l1xASAhJH3uZZTG5ZtrIaLoSW0 Vlt3LR56LkfdgIwFn8h9x8luFpyysqcgtuqajfLCZo702fDBFDaJyfYgivrN+No+G6f5 k3ABVVOVTwyVz2Ta6as6cfI/iEWhRisXrRq/z59QJQc3tS7LD0t1NjAd2xu1XDoczpDT /krjE+VvXlOr5X4JPY8+qeprmPF/KfibJu6CUaizPdvEgIJ1WE+Lj4w5olltStQPksna epQw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=alC2osDX; 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 c4si3679846pfi.110.2019.01.10.04.42.35; Thu, 10 Jan 2019 04:42:51 -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=bombadil.20170209 header.b=alC2osDX; 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 S1728417AbfAJMla (ORCPT + 99 others); Thu, 10 Jan 2019 07:41:30 -0500 Received: from bombadil.infradead.org ([198.137.202.133]:60320 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727916AbfAJMla (ORCPT ); Thu, 10 Jan 2019 07:41:30 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.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=xCx8b08LW7Cc4m9Iovv8U6+26LBBjqnoySmyNAnN9Bg=; b=alC2osDXt6KDkZF3VBb3TWUeV sU6ZFqmcBvDa3HbA3nqg67bsUp1x1yGpbUl/rEHsKEeD2ZFqwBAzXHt0mV9mmI4w+XfwxsFrpFLOP gU21r8C9eVoNi0cUs0tkJUNfKNRSHjB7opYadFQjY8bEZ1/WxYXx/S61LgIt/3Q+EUhxksbeG72jY qVjml9W3toAgfPdy9Dw6bD6PX8yIysI6U1WX7zXH5OcXZD+EwcTrU/8MzJY8eqgN+FWgzOBOKV7me Nl0EZGZqZpVmoZ2I6Q/iT0bVGrCQF7soz1xt+MjEclEbCzjAr6q3914BEvfPRFZf+R5fvirtoVmq3 rBu9CV+Lg==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=hirez.programming.kicks-ass.net) by bombadil.infradead.org with esmtpsa (Exim 4.90_1 #2 (Red Hat Linux)) id 1ghZeI-0002re-Jx; Thu, 10 Jan 2019 12:41:26 +0000 Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id D2A412081518E; Thu, 10 Jan 2019 13:41:23 +0100 (CET) Date: Thu, 10 Jan 2019 13:41:23 +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: <20190110124123.GA21224@hirez.programming.kicks-ass.net> References: <20190108223746.shuwx3ro7cgwz7hh@breakpoint.cc> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190108223746.shuwx3ro7cgwz7hh@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 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. > Only alternative I see that might work is synchronize_rcu (the > _do_table functions are called with rcu read lock held). > > I guess current scheme is cheaper though. Is performance a concern in this path? There is no comment justifying this 'creative' stuff.