Received: by 10.213.65.68 with SMTP id h4csp496369imn; Tue, 27 Mar 2018 03:31:51 -0700 (PDT) X-Google-Smtp-Source: AG47ELsEKIXUlI1SbGn2EtLkeeUkhKqP4O7ZxRJaWRdhuDEcNGQi9urRcn+iUyDApWnbt2Jx725L X-Received: by 10.99.103.197 with SMTP id b188mr16633616pgc.108.1522146711527; Tue, 27 Mar 2018 03:31:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1522146711; cv=none; d=google.com; s=arc-20160816; b=Oom0KkwcVLYBvMMCY4mBsTILI6gKGu+e1K2jDJmQrATmFo76txY6lXUAZRm0fZFFmB M9mqAgn+c22BkL8otl9/TSGbtmPLtIpUpJYof/+v20nhbyZ5GKwAI65y8aHtkxnxRIkV JNVDp+PgGCjiBIyN1ct3C0VAGwJ3yFflcz02o3sCQY+R3oKTmrxAjUvphberlU33Imzd T+HYLj6Yl+knV8mfFIX5idlU4lssq0StmpFQjF1GvyZbT+n02dVbRpuQsT80ISy7xrG9 gZqwtBnID87G3HdqeIibvhBJJMRnkBipuU5ApJhAEE2N7kIyYt4j22kybo1oBfNVwg+M CrYg== 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:arc-authentication-results; bh=50MCTAJWpLKxdEMURNEfCDAsONBUJW/D+kGOJcb613Y=; b=XOE7galrw9kFrM4MMydKqzCgcNhOMJqtpY2j8yXegt2U/fYZA18LcWmZhX5HW5bCea UKPHTkS1q9L0BN8q2zwFWRQsZ/kKA+yd+uXxA90HqQyyx/K6mS6VvLs2bQRFamU1SdjP RVg467lskDbzz0VVDR474z3iA81yN6ATLM7cOIRkwCjNX6xqNN8ZSLhm9OtSslbrIxRA EVfxpV2o+dRN8zcd7suUbD9FkDX2FWd7R0yeam6/zsrcIwHFWhDyIW/6U4W4EZaY9rzl fPLUodqghUQm8WZzYbEmjtrdml7e9kvp4yCkfyOZbUJM+DK6aXIiqfOeLBx3mkX1Dbux /PsA== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j10-v6si1054790plk.655.2018.03.27.03.31.37; Tue, 27 Mar 2018 03:31:51 -0700 (PDT) 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752203AbeC0KVI (ORCPT + 99 others); Tue, 27 Mar 2018 06:21:08 -0400 Received: from foss.arm.com ([217.140.101.70]:52264 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750944AbeC0KVH (ORCPT ); Tue, 27 Mar 2018 06:21:07 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id C351B1435; Tue, 27 Mar 2018 03:21:06 -0700 (PDT) Received: from edgewater-inn.cambridge.arm.com (usa-sjc-imap-foss1.foss.arm.com [10.72.51.249]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 934F63F590; Tue, 27 Mar 2018 03:21:06 -0700 (PDT) Received: by edgewater-inn.cambridge.arm.com (Postfix, from userid 1000) id 5119A1AE12D3; Tue, 27 Mar 2018 11:21:17 +0100 (BST) Date: Tue, 27 Mar 2018 11:21:17 +0100 From: Will Deacon To: Yury Norov Cc: "Paul E. McKenney" , Chris Metcalf , Christopher Lameter , Russell King - ARM Linux , Mark Rutland , Steven Rostedt , Mathieu Desnoyers , Catalin Marinas , Pekka Enberg , David Rientjes , Joonsoo Kim , Andrew Morton , Benjamin Herrenschmidt , Paul Mackerras , Michael Ellerman , linux-arm-kernel@lists.infradead.org, linuxppc-dev@lists.ozlabs.org, kvm-ppc@vger.kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 2/2] smp: introduce kick_active_cpus_sync() Message-ID: <20180327102116.GA2464@arm.com> References: <20180325175004.28162-1-ynorov@caviumnetworks.com> <20180325175004.28162-3-ynorov@caviumnetworks.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180325175004.28162-3-ynorov@caviumnetworks.com> User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, Mar 25, 2018 at 08:50:04PM +0300, Yury Norov wrote: > kick_all_cpus_sync() forces all CPUs to sync caches by sending broadcast IPI. > If CPU is in extended quiescent state (idle task or nohz_full userspace), this > work may be done at the exit of this state. Delaying synchronization helps to > save power if CPU is in idle state and decrease latency for real-time tasks. > > This patch introduces kick_active_cpus_sync() and uses it in mm/slab and arm64 > code to delay syncronization. > > For task isolation (https://lkml.org/lkml/2017/11/3/589), IPI to the CPU running > isolated task would be fatal, as it breaks isolation. The approach with delaying > of synchronization work helps to maintain isolated state. > > I've tested it with test from task isolation series on ThunderX2 for more than > 10 hours (10k giga-ticks) without breaking isolation. > > Signed-off-by: Yury Norov > --- > arch/arm64/kernel/insn.c | 2 +- > include/linux/smp.h | 2 ++ > kernel/smp.c | 24 ++++++++++++++++++++++++ > mm/slab.c | 2 +- > 4 files changed, 28 insertions(+), 2 deletions(-) > > diff --git a/arch/arm64/kernel/insn.c b/arch/arm64/kernel/insn.c > index 2718a77da165..9d7c492e920e 100644 > --- a/arch/arm64/kernel/insn.c > +++ b/arch/arm64/kernel/insn.c > @@ -291,7 +291,7 @@ int __kprobes aarch64_insn_patch_text(void *addrs[], u32 insns[], int cnt) > * synchronization. > */ > ret = aarch64_insn_patch_text_nosync(addrs[0], insns[0]); > - kick_all_cpus_sync(); > + kick_active_cpus_sync(); > return ret; > } > } I think this means that runtime modifications to the kernel text might not be picked up by CPUs coming out of idle. Shouldn't we add an ISB on that path to avoid executing stale instructions? Will