Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp839513imu; Fri, 11 Jan 2019 09:57:12 -0800 (PST) X-Google-Smtp-Source: ALg8bN7JivegG4cIcEFaFcmygzXy54NMs5kut6mK6JNpgaHHqMzm27xPYiJPwKocEDbzdqvTzAt8 X-Received: by 2002:a62:7042:: with SMTP id l63mr16124437pfc.89.1547229432090; Fri, 11 Jan 2019 09:57:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1547229432; cv=none; d=google.com; s=arc-20160816; b=IyGjyRmYPC9BTkhA7Pfq19Mab0J4959nLe8kIwSW7GT2m46jBIFXSz0yiy0X6JzJNk 0SgBjlF1iktR4G5SIqFbY4Rn/clqTtla7KKFSZnCCBiz/5IfBSRL+QbCnIz7LPE0jerE 3af3HDhYWNLsyi01UQhf7o8Z8IB4wOfltkOzcX4MNNSdo7cfHoSf83suZMUaxMM2gi1z OCkDi/HhOCgCU9fFq1GJkA/7RUh8oVAVBaQ8pIfOgPQWGlShqOipN2VtNsOamfK41Cbf OmMmgpwvbqHRRRzMt4XHVqYc2PjpBB19uQZ39G5JoJlNMfs5hp7DUshSqb9AtktXC7R4 BRJg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:user-agent:in-reply-to :content-disposition:mime-version:references:reply-to:subject:cc:to :from:date; bh=7YO/1yD4mbUTPWCs6k7IzDHg6kPpQOQzaMIz9PHBfgY=; b=i6m5gn1P+VLkrk/n2XnGmW2OH8n8IH9DwLzpYLVxmg2XfrC3Rk2pCIv/TYnkyx2eso kbpxn59VErSyK8eJSQPeruVni5uoRkPAZO/amTF+SfCmPKjgQJ5NHS32JLDyEMja7/uc BLj8EZ4mlgRzp4TGNx3gS9DNvkSBkJmH37wBSLnoZncqCAYvoZ3h+v5y5/1I2O/ljuYJ XfaRYgy9VvW/tAK+38qmpQP+ebNUIFn1OmlM15XfinKD0QDd0Uyn81RlBvq71Tku1K5+ Ax/mtP3tTQx2G37nzuEjOP6QHkXDEajLP7Yw/roM9+wFs4CrWs56LDucjmK5+RiaF6T5 Jexg== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n24si28732115pgv.119.2019.01.11.09.56.55; Fri, 11 Jan 2019 09:57:12 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730667AbfAKOIR (ORCPT + 99 others); Fri, 11 Jan 2019 09:08:17 -0500 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:44416 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727753AbfAKOIQ (ORCPT ); Fri, 11 Jan 2019 09:08:16 -0500 Received: from pps.filterd (m0098410.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id x0BE43GL139602 for ; Fri, 11 Jan 2019 09:08:16 -0500 Received: from e17.ny.us.ibm.com (e17.ny.us.ibm.com [129.33.205.207]) by mx0a-001b2d01.pphosted.com with ESMTP id 2pxuy8j420-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Fri, 11 Jan 2019 09:08:15 -0500 Received: from localhost by e17.ny.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Fri, 11 Jan 2019 14:08:14 -0000 Received: from b01cxnp23033.gho.pok.ibm.com (9.57.198.28) by e17.ny.us.ibm.com (146.89.104.204) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Fri, 11 Jan 2019 14:08:11 -0000 Received: from b01ledav003.gho.pok.ibm.com (b01ledav003.gho.pok.ibm.com [9.57.199.108]) by b01cxnp23033.gho.pok.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id x0BE8AwU24510570 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Fri, 11 Jan 2019 14:08:10 GMT Received: from b01ledav003.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 74F7DB205F; Fri, 11 Jan 2019 14:08:10 +0000 (GMT) Received: from b01ledav003.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 5EE9BB206A; Fri, 11 Jan 2019 14:08:10 +0000 (GMT) Received: from paulmck-ThinkPad-W541 (unknown [9.80.208.131]) by b01ledav003.gho.pok.ibm.com (Postfix) with ESMTP; Fri, 11 Jan 2019 14:08:10 +0000 (GMT) Received: by paulmck-ThinkPad-W541 (Postfix, from userid 1000) id 8816F16C2B83; Fri, 11 Jan 2019 06:08:10 -0800 (PST) Date: Fri, 11 Jan 2019 06:08:10 -0800 From: "Paul E. McKenney" To: Peter Zijlstra Cc: Florian Westphal , Anatol Pomozov , Dmitry Vyukov , LKML Subject: Re: seqcount usage in xt_replace_table() Reply-To: paulmck@linux.ibm.com References: <20190108223746.shuwx3ro7cgwz7hh@breakpoint.cc> <20190110124123.GA21224@hirez.programming.kicks-ass.net> <20190110144812.mkbokbj2iyryj6lv@breakpoint.cc> <20190110202533.GK2861@worktop.programming.kicks-ass.net> <20190110222920.jqpzzv74huc2lb7f@breakpoint.cc> <20190111083411.GM1900@hirez.programming.kicks-ass.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190111083411.GM1900@hirez.programming.kicks-ass.net> User-Agent: Mutt/1.5.21 (2010-09-15) X-TM-AS-GCONF: 00 x-cbid: 19011114-0040-0000-0000-000004B062CF X-IBM-SpamModules-Scores: X-IBM-SpamModules-Versions: BY=3.00010385; HX=3.00000242; KW=3.00000007; PH=3.00000004; SC=3.00000274; SDB=6.01144945; UDB=6.00593882; IPR=6.00925214; MB=3.00025083; MTD=3.00000008; XFM=3.00000015; UTC=2019-01-11 14:08:13 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 19011114-0041-0000-0000-000008BB68FC Message-Id: <20190111140810.GA1215@linux.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:,, definitions=2019-01-11_08:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=936 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1901110115 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Jan 11, 2019 at 09:34:11AM +0100, Peter Zijlstra wrote: > On Thu, Jan 10, 2019 at 11:29:20PM +0100, Florian Westphal wrote: > > Peter Zijlstra wrote: > > > Would using synchronize_rcu() not also mean you can get rid of that > > > xt_write_recseq*() stuff entirely? > > > > No, because those are used to synchronize with cpus that read > > the ruleset counters, see > > > > net/ipv4/netfilter/ip_tables.c:get_counters(). > > Ah, bummer :/ > > > > Anyway, synchronize_rcu() can also take a little while, but I don't > > > think anywere near 30 seconds. > > > > Ok, I think in that case it would be best to just replace the > > recseq value sampling with smp_mb + synchronize_rcu plus a comment > > that explains why its done. > > synchronize_rcu() implies smp_mb() on all CPUs. Yes, it does, but in the case of idle CPUs, the smp_mb() calls are only required to follow any pre-existing RCU read-side critical section on the one hand an precede any RCU read-side critical section completing after the synchronize_rcu() on the other. To do more would mean waking up idle CPUs, which does not make the battery-powered guys happy. ;-) Thanx, Paul